import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    lateinit var calc: (IntArray) -> Unit

    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val D = sc.next().toInt()
        val c = IntArray(26) { sc.next().toInt() }
        val s = Array(D) { IntArray(26) { sc.next().toInt() } }
//        val t = IntArray(D) { sc.next().toInt() }
//        val M = sc.next().toInt()
//        val dq = Array(M) { Pair(sc.next().toInt(), sc.next().toInt()) }

        // calc result
        calc = { t: IntArray ->
            val d = IntArray(26)
            var ans = 0L
            for (i in 0 until D) {
                ans += s[i][t[i] - 1]
                d[t[i] - 1] = i + 1
                for (j in 0 until 26) {
                    ans -= c[j] * (i + 1 - d[j])
                }
                pw.println(ans)
            }
        }

        val ans = (0 until D).map { it % 26 + 1 }.toIntArray()
        pw.println(ans.joinToString("\n"))

        //calc(ans)
    }
}
