fun int() = readLine()!!.toInt()
fun ints() = readLine()!!.split(" ").map {it.toInt()}.toIntArray()

fun triangle(n:Int) = n*(n+1)/2

fun main() {
	val day = int()
	val days = 0 until day
	val types = 0..25

	val penalty = ints()
	val advantage = Array(day) {ints()}

	var r = 0L
	val t = IntArray(day) {-1}

	fun lastLeft(d:Int,type:Int) = (d downTo 0).find {t[it]==type} ?: -1

	fun calcPenaltySum(d:Int,type:Int) = penalty[type]*triangle(d-lastLeft(d,type))

	for(d in days) {
		val ct = types.maxBy {advantage[d][it]+calcPenaltySum(d,it)}!!
		t[d] = ct
		r += advantage[d][ct]-calcPenaltySum(d-1,ct)
	}

	for(ct in types)
		r -= calcPenaltySum(364,ct)

	System.err.println(r)
	t.forEach {println(it+1)}
}
