import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set, TreeSet}
import scala.util.Random
import java.util.Date

object Main extends App {
  val startTime = new Date().getTime // to milli seconds

  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val D = in.next().toInt
  val c = new Array[Long](26+1)
  val s = Array.ofDim[Long](D+1, 26+1)

  for (i <- 1 to 26) {
    c(i) = in.next().toInt
  }
  for (d <- 1 to D) {
    for (i <- 1 to 26) {
      s(d)(i) = in.next().toInt
    }
  }


  //
  class Board(val t: Array[Int]) {

    // 各コンテストの開催日をセットで保持する
    private val eventDays = Array.fill(26+1)(TreeSet[Int]())

    var score: Long = {
      var res = 0L

      val last = new Array[Int](26+1)
      for (day <- 1 to D) {
        val now = t(day)

        last(now) = day
        eventDays(now) += day

        res += s(day)(now)
        for (contest <- 1 to 26) {
          res -= c(contest) * (day - last(contest))
        }
      }

      res
    }

    // ${day}日の開催コンテストを, ${contest}に変更する
    def update(day: Int, contest: Int): Unit = {
      def tousa(l: Int): Int = ((1 + l) * l) / 2

      score -= s(day)(t(day))
      score += s(day)(contest)

      val delSet = eventDays(t(day))
      delSet -= day
      var start = delSet.maxBefore(day).getOrElse(0)
      var end = delSet.minAfter(day).map(_ - 1).getOrElse(D)
      score += c(t(day)) * tousa((day-1) - start)
      score += c(t(day)) * tousa(end - day)
      score -= c(t(day)) * tousa(end - start)

      val addSet = eventDays(contest)
      start = addSet.maxBefore(day).getOrElse(0)
      end = addSet.minAfter(day).map(_ - 1).getOrElse(D)
      score -= c(contest) * tousa((day-1) - start)
      score -= c(contest) * tousa(end - day)
      score += c(contest) * tousa(end - start)
      addSet += day

      t(day) = contest
    }
  }


  /** functions **/


  /** solve **/
  val t = new Array[Int](D+1)
  val last = new Array[Int](26+1)
  for (d <- 1 to D) {
    val (_, ty) =
      s(d).zipWithIndex
        .drop(1)
        .map{ case (s, ty) => (s + c(ty) * (d - last(ty)), ty) }
        .max

    t(d) = ty
    last(ty) = d
  }

  val board = new Board(t)

  val endTime = 1400
  var currentScore = board.score
  var bestAns = t.clone
  var bestScore =  currentScore

  val annStartTime = new Date().getTime
  var currentTime = annStartTime

  val T = endTime - annStartTime // 焼きなましにかける時間
  val R = 10000

  while ((new Date().getTime - startTime) < endTime) {
    for (_ <- 1 to 1000) {
      val time = currentTime - annStartTime // 焼きなまし法開始からの時間


      /** 変更 **/
      {
        val d = Random.nextInt(D) + 1
        val ty = Random.nextInt(26) + 1

        val tmp = board.t(d)
        board.update(d, ty)

        val nextScore = board.score // 遷移後のスコアを計算

        // スコアが悪くなったときでも、次の状態に移動する遷移する場合はtrue。
        val ForceNext = T * Random.nextInt(R) < (T-time) * R // １次関数
        
        if (nextScore > currentScore || ForceNext)
          currentScore = nextScore // 遷移を適用
        else
          board.update(d, tmp) // 遷移を破棄

        // ベストスコアを保存
        if (currentScore > bestScore) {
          bestScore = currentScore
          bestAns = board.t.clone // 現在の盤面を渡す
        }
      }

      /** swap **/
      {
        val d = Random.nextInt(D-1) + 1

        val tmp = board.t(d)
        board.update(d, board.t(d+1))
        board.update(d+1, tmp)

        val nextScore = board.score // 遷移後のスコアを計算

        // スコアが悪くなったときでも、次の状態に移動する遷移する場合はtrue。
        val ForceNext = T * Random.nextInt(R) < (T-time) * R // １次関数
        
        if (nextScore > currentScore || ForceNext)
          currentScore = nextScore // 遷移を適用
        else {
          val tmp2 = board.t(d)
          board.update(d, board.t(d+1))
          board.update(d+1, tmp2)
        }

        // ベストスコアを保存
        if (currentScore > bestScore) {
          bestScore = currentScore
          bestAns = board.t.clone // 現在の盤面を渡す
        }
      }
    }
  }

  val last2 = new Array[Int](26+1)
  for (d <- 1 to D) {
    if (d == D) {
      val (_, ty) =
        s(d).zipWithIndex
          .drop(1)
          .map{ case (s, ty) => (s + c(ty) * (d - last2(ty)), ty) }
          .max

      board.t(d) = ty
    }
    else {
      last2(board.t(d)) = d
    }
  }


  for (d <- 1 to D) {
    pw.println(board.t(d))
  }
  pw.flush()
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.toList))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 64680