# 焼きなまし（2500から線形に落とす）

from time import time
from math import exp
key = 1
rnd_mod = 12345678901234567891
rnd_x = 9876543210987654321 + 1234567890123456789 * key % rnd_mod
def rnd():
    global rnd_x
    rnd_x = rnd_x**2 % rnd_mod
    return (rnd_x>>10) % (1<<40)
def randrange(a, b=-1):
    if b > 0: return randrange(b-a) + a
    return rnd() % a

def calc():
    s = 0
    last = [-1] * 26
    for i, t in enumerate(A):
        s += S[i][t]
        last[t] = i
        for j, c in enumerate(C):
            s -= c * (i - last[j])
    return s

sTime = time()
D = int(input())
C = [int(a) for a in input().split()]
S = [[int(a) for a in input().split()] for _ in range(D)]
A = [randrange(26) for _ in range(D)]
# A = [0] * D
# A = [0, 16, 12, 13, 12]
# A = [0, 16, 12, 13, 19]
ans = calc()
# print("ans =", ans)

def day_all(d):
    global ans
    i = A[d]
    for k in range(d)[::-1]:
        if A[k] == i:
            prev = k
            break
    else:
        prev = -1
    for k in range(d + 1, D):
        if A[k] == i:
            prev_ne = k
            break
    else:
        prev_ne = D
    for j in range(26):
        t = S[d][j] - S[d][i]
        for k in range(d)[::-1]:
            if A[k] == j:
                new = k
                break
        else:
            new = -1
        for k in range(d + 1, D):
            if A[k] == j:
                new_ne = k
                break
        else:
            new_ne = D
        t += C[j] * (d - new) * (new_ne - d) - C[i] * (d - prev) * (prev_ne - d)
        if (T < 1 and t > 0) or (T >= 1 and randrange(1 << 10) < exp(max(min(t / T, 0), -10)) * (1 << 10)):
            A[d] = j
            ans += t
            prev, prev_ne = new, new_ne
            i = j
            if 0:
                print("A =", A)
                print("ans =", ans)
                print("calc =", calc())

def swap(d1, d2):
    global ans
    i = A[d1]
    j = A[d2]
    for d in range(d1 + 1, d2):
        if A[d] == i:
            d1 = d
        if A[d] == j:
            d2 = d
            break
    for d in range(d1)[::-1]:
        if A[d] == i:
            previ = d
            break
    else:
        previ = -1
    for d in range(d1)[::-1]:
        if A[d] == j:
            prevj = d
            break
    else:
        prevj = -1
    for d in range(d2 + 1, D):
        if A[d] == i:
            nei = d
            break
    else:
        nei = D
    for d in range(d2 + 1, D):
        if A[d] == j:
            nej = d
            break
    else:
        nej = D
    
    t = S[d1][j] - S[d1][i] - S[d2][j] + S[d2][i]
    t -= (nei - d1 - d1 + previ) * (d2 - d1)
    t += (nej - d2 - d2 + prevj) * (d2 - d1)
    if (T < 1 and t > 0) or (T >= 1 and randrange(1 << 10) < exp(max(min(t / T, 0), -10)) * (1 << 10)):
        A[d1], A[d2] = j, i
        ans += t


ans = calc()
loop = 0
while 1:
    if loop % 100 == 0:
        tt = (time() - sTime) / 1.8
        if tt >= 1:
            break
        T = 2500 * (1 - tt)
    loop += 1
    
    if randrange(1 << 10) < tt:
        d1 = randrange(D)
        d2 = d1
        while A[d1] == A[d2]:
            d2 = randrange(D)
        if d2 < d1: d1, d2 = d2, d1
        swap(d1, d2)
        if 0:
            print("2")
            print("ans =", ans)
            print("calc =", calc())
        
    else:
        d = randrange(D)
        day_all(d)
        if 0:
            print("1")
            print("ans =", ans)
            print("calc =", calc())
    
print(*[a + 1 for a in A], sep = "\n")
if 0:
    print(ans)
    print("A =", A)


Measured memory_bytes: 78440