import time
import random
import copy

class Problem:

    def __init__(self, D, s, c):
        self.last_days = [0] * 26
        self.D = D
        self.s = s
        self.c = c
        self.answer = [0] * self.D
        self.best_answer = [0] * self.D

    def scoring(self, day, ind):
        day_score = self.s[day][ind]
        minus_score = 0
        for i in range(26):
            if i != ind:
                minus_score += self.c[i] * (day + 1 - self.last_days[i])
        day_score -= minus_score
        return day_score

    def get_all_scores(self, day):
        """全ての選択肢のscoreを返す"""
        minus_score = 0
        all_scores = [0] * 26
        for i in range(26):
            if i == 0:
                for j in range(1, 26):
                    minus_score += self.c[j] * (day + 1 - self.last_days[j])
                all_scores[0] = self.s[day][0] - minus_score

            else:
                minus_score += self.c[i - 1] * (day + 1 - self.last_days[i - 1])
                minus_score -= self.c[i] * (day + 1 - self.last_days[i])
                all_scores[i] = self.s[day][i] - minus_score
        return all_scores

    def _strategy_greedy(self, day):
        perturbation = random.randint(1, 4)
        all_scores = self.get_all_scores(day)
        all_scores_with_ind = [[i, all_scores[i]] for i in range(26)]
        all_scores_with_ind.sort(key=lambda x: x[1])
        ind = all_scores_with_ind[-perturbation][0]
        score = self.scoring(day, ind)
        return score, ind

    def solve(self):
        self.init()

        sum_score = 0
        for i in range(self.D):
            score, ind = self._strategy_greedy(i)
            self.last_days[ind] = i + 1
            self.answer[i] = ind
            sum_score += score
        return sum_score, self.answer

    def _strategy_perturbation(self, day):
        all_scores = self.get_all_scores(day)
        all_scores_with_ind = [[i, all_scores[i]] for i in range(26)]
        all_scores_with_ind.sort(key=lambda x: x[1])
        # ランダムに１日を取り出し、一番その日の期待コストが大きくなるよう変化させる
        # 貪欲法に摂動を加えてみる
        ind = all_scores_with_ind[-1][0]
        # scores = [self.scoring()]

    def solve_perturbation(self):
        self.init()

        for i in range(4):
            day = random.randint(1, self.D)
            self.best_answer[day] = self._strategy_perturbation(day)

    # def calc_answer(self):
    #     self.init()
    #
    #     for i in range(self.D):



    def init(self):
        self.last_days = [0] * 26
        self.answer = [0] * self.D


def main():
    time_start = time.time()
    DO_TIME = 2 * 0.90
    D = int(input())
    c = list(map(int, input().split()))
    s = []

    for _ in range(D):
        s.append(list(map(int, input().split())))

    max_score = 0

    problem = Problem(D, s, c)
    ite = 0
    while time.time() - time_start < DO_TIME:
        ite += 1
        score, answer = problem.solve()

        if score > max_score:
            # print("hit")
            # print(max_score)
            max_score = score
            problem.best_answer = copy.copy(answer)

    for i in range(D):
        problem.best_answer[i] += 1
        print(problem.best_answer[i])
        # print(1)
    # print(ite)
    # print(max_answer)
    #     print(max_score)
    # print(problem.get_all_scores(1))


main()


Measured memory_bytes: 84040