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])
    sat = 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)
        sat += max_sat
    





    # 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])

    satisfactions = [0] * D
    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)







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

        old_idx = bisect_left(last_helds[old],d)
        #dbg(last_helds[old],d,old_idx)
        x = last_helds[old][old_idx - 1]
        y = last_helds[old][old_idx + 1]
        # dbg('old x,y',d,x,y,(1+(y-1-(d)))*(y-(d)-1)//2,(1+(d)-x-1)*((d)-x-1)//2,(1+ y-x-1)*(y-x-1)//2)
        satisfaction += C[old] * ((1+(y-1-(d)))*(y-(d)-1)//2  + (1+(d)-x-1)*((d)-x-1)//2  - (1+ y-x-1)*(y-x-1)//2)

        
        new_idx = bisect_left(last_helds[q],d)
        # dbg(last_helds[q],d,new_idx)
        x = last_helds[q][new_idx-1]
        y = last_helds[q][new_idx]
        satisfaction += C[q]*((1+y-x-1)*(y-x-1)//2 - (1+(d)-x-1)*((d)-x-1)//2 -(1+y-(d)-1)*(y-(d)-1)//2)

        
        if old_satisfaction < satisfaction:
            last_helds[old].pop(old_idx)
            # dbg('insert')
            # dbg(last_helds[q])
            last_helds[q].insert(new_idx,d)
            # dbg(last_helds[q])
            T[d] = q

            # print(satisfaction)
        else:
            satisfaction = old_satisfaction



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

Measured memory_bytes: 86084