def main():
    from time import perf_counter
    start_time = perf_counter()
    from random import random
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    from bisect import bisect_left,bisect_right
    
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    D = II()
    C = LMIIS()
    S = []
    for i in range(D):
        S.append(LMIIS())



    T = [0]*D
    last_helds = []
    for _ in range(26):
        last_helds.append([-1])
    satisfaction = 0
    for i in range(D):
        max_sat = -INF
        max_type = -1
        L = S[i]
        reduction = 0
        for j in range(26):
            reduction += C[j] * (i-last_helds[j][-1])
        for j in range(26):
            tmp = -reduction + C[j]* (i-last_helds[j][-1])
            tmp += S[i][j]
            if max_sat < tmp:
                max_sat = tmp
                max_type = j
            

            
        T[i] = max_type
        last_helds[max_type].append(i)
        satisfaction += max_sat
    # dbg(satisfaction)
    





    # M = II()
    # Q = []
    # for i in range(M):
    #     d,q = LMIIS()
    #     Q.append((d-1,q-1))
    # satisfaction = 0
    # last_helds = []
    # for i in range(26):
    #     last_helds.append([-1])

    # for i,t in enumerate(T):
    #     last_helds[t].append(i)
    #     for j in range(26):
    #         satisfaction -= C[j] * (i-last_helds[j][-1])
    #     satisfaction += S[i][t]
    

    
    for i in range(26):
        last_helds[i].append(D)






    satisfaction += 10**6

    # while perf_counter() - start_time < 1.9191919:
    #     #d,q = int(random()*(D-1)), int(random()*(25))
    #     count += 1
    for count in range(26*D):
        d,q = count//26%D,count%26
        dbg(d,q)
        old = T[d]
        old_satisfaction = satisfaction
        satisfaction -= S[d][old]
        satisfaction += S[d][q]

        last_helds_old = last_helds[old]
        old_idx = bisect_left(last_helds_old,d)

        x = last_helds_old[old_idx - 1]
        y = last_helds_old[old_idx + 1]
        a = y-d-1
        b = d-x-1
        c = y-x-1
        satisfaction += C[old] * (a*(a+1) + b*(b+1) - c*(c+1))//2

        last_helds_q = last_helds[q]
        new_idx = bisect_left(last_helds_q,d)
        last_helds_q = last_helds[q]
        x = last_helds_q[new_idx-1]
        y = last_helds_q[new_idx]
        a = y-x-1
        b = d-x-1
        c = y-d-1
        satisfaction += C[q]*(a*(a+1) - b*(b+1) - c*(c+1))//2

        if old_satisfaction < satisfaction:
            last_helds_old.pop(old_idx)
            last_helds_q.insert(new_idx,d)
            T[d] = q
        else:
            satisfaction = old_satisfaction
    



    while perf_counter() - start_time < 1.9191919:
        d,q = int(random()*(D-1)), int(random()*(25))
        dbg(d,q)
        old = T[d]
        old_satisfaction = satisfaction
        satisfaction -= S[d][old]
        satisfaction += S[d][q]

        last_helds_old = last_helds[old]
        old_idx = bisect_left(last_helds_old,d)

        x = last_helds_old[old_idx - 1]
        y = last_helds_old[old_idx + 1]
        a = y-d-1
        b = d-x-1
        c = y-x-1
        satisfaction += C[old] * (a*(a+1) + b*(b+1) - c*(c+1))//2

        last_helds_q = last_helds[q]
        new_idx = bisect_left(last_helds_q,d)
        last_helds_q = last_helds[q]
        x = last_helds_q[new_idx-1]
        y = last_helds_q[new_idx]
        a = y-x-1
        b = d-x-1
        c = y-d-1
        satisfaction += C[q]*(a*(a+1) - b*(b+1) - c*(c+1))//2

        if old_satisfaction < satisfaction:
            last_helds_old.pop(old_idx)
            last_helds_q.insert(new_idx,d)
            T[d] = q
        else:
            satisfaction = old_satisfaction



    for t in T:
        print(t+1)
    dbg(satisfaction)
main()

Measured memory_bytes: 89000