Problem:
   Problem Statement AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.   The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.  Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i} .  If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i , and at the end of each day d=1,2,...,D , the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d ) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0 . At the end of day d , the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)) .   Please schedule contests on behalf of AtCoder.
If the satisfaction at the end of day D is S , you will get a score of \max(10^6 + S, 0) .
There are 50 test cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your submissions will be your score.      Constraints  D = 365  Each c_i is an integer satisfying 0\leq c_i \leq 100 .  Each s_{d,i} is an integer satisfying 0\leq s_{d,i} \leq 20000 .         Input Input is given from Standard Input in the following format:  D  c_1  c_2  \cdots  c_{26}  s_{1,1}  s_{1,2}  \cdots  s_{1,26}  \vdots  s_{D,1}  s_{D,2}  \cdots  s_{D,26}       Output Let t_d ( 1\leq t_d \leq 26 ) be the type of the contest that will be held at day d .
Print D integers t_d to Standard Output in the following format:  t_1  t_2  \vdots  t_D   Any output that does not follow the above format may result in 0 points WA for that test case.      Input Generation Each integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.        Sample Input 1 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192      Sample Output 1 1
17
13
14
13  Note that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.  Input generator, score calculator, and visualizer      Beginner's Guide If you don't know what to do, proceed to problem B or C.

Solution (Python):
d = int(input())

lc = list(map(int, input().split()))
ls = []
for i in range(d):
    ls.append(list(map(int, input().split())))

for i in range(d):
    print(ls[i].index(max(ls[i]))+1)

Solution (Python):










import sys

def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip("\n") for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]




sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)




N_ALP = 26

D = iIn()
C = iInLH()
S = iInLD(D)

T = []

for i in range(365):
  print(10)

Solution (Python):
d=int(input())
c=list(map(int,input().split()))


ss=[list(map(int,input().split())) for i in range(d)]

for i in range(d):
    print(i%26+1)

Solution (Python):
import numpy as np

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

for S in s:
  print(np.argmax(S)+1)

Solution (Python):

import sys
def main(D, C, S):
    def evaluate(i, t, satisfaction, last):
        satisfaction += S[i][t]
        last[t] = i
        for j, c in enumerate(C):
            satisfaction -= c * (i - last[j])
        return (satisfaction, last)

    ans = []
    satisfaction = 0
    last = [-1] * 26
    for i in range(D):
        tt = -1
        ts = -10**10
        tl = None
        ps = satisfaction
        pl = last[:]
        for t in range(26):
            s, l = evaluate(i, t, ps, pl[:])
            if ts < s:
                tt = t
                ts = s
                tl = l
        ans.append(tt + 1)
        satisfaction = ts
        last = tl
    return ans

if __name__ == '__main__':
    input = sys.stdin.readline
    D = int(input())
    *C, = map(int, input().split())
    S = [list(map(int, input().split())) for _ in range(D)]
    ans = main(D, C, S)
    for a in ans:
        print(a)

Solution (Python):
def lackSatisfaction(c, d, last):
    lack = 0
    max = 0
    mindex = 0
    for i in range(len(c)):
        tmp = c[i] * (d - last[i])
        lack += tmp
        if (max < tmp):
            max = tmp
            mindex = i
    return max, mindex


D = int(input())
c = list(map(int, input().split()))

d = []
last = {}
for i in range(26):
    last[i] = 0

for i in range(D):
    s = list(map(int, input().split()))
    rate = 0
    type = 0
    maxLack, mindex = lackSatisfaction(c, i + 1, last)
    for j in range(len(s)):
        if (rate < s[j]):
            rate = s[j]
            type = j + 1
    if (maxLack < rate):
        d.append(type)
    else:
        d.append(mindex)
    last[type - 1] = i + 1

for i in range(len(d)):
    print(d[i])

Solution (Python):
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
mem = [0 for i in range(26)]
v = 0
su = sum(c)
for a in range(d):
    print(1)

Solution (Python):
def select_type(n, satis_day):
    type = satis_day[n].index(max(satis_day[n]))
    return type

total_days = int(input())
c = list(map(int, input().split()))
satis_day = [[0] * 26 for i in range(total_days)]
for i in range(total_days):
    satis_day[i] = list(map(int, input().split()))

total_satis = 0
not_held_count = [0] * 26

for i in range(total_days):
    
    
    type = select_type(i, satis_day)
    
    not_held_count = list(map(lambda x: x+1, not_held_count))
    not_held_count[type] = 0
    
    today_decrease = 0
    for j in range(26):
        today_decrease += c[j] * not_held_count[j]
    
    total_satis += (satis_day[i][type] - today_decrease)
    
    print(type+1)

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
S = []
for _ in range(D):
    ver = list(map(int,input().split()))
    S.append(ver)
d = 0
last = [0 for _ in range(26)]

t = []
for d in range(1, D+1):
    dc = [C[i]*(d-last[i]) for i in range(26)]
    best = []
    for i in range(26):
        if_i = S[d-1][i] + dc[i]
        best.append(if_i)
    t.append(best.index(max(best))+1)
    
    last_i = best.index(max(best))
    last[last_i] += 1
for t_i in t:
    print(t_i)

Solution (Python):
import random
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

score = 0
last_day = [-1] * 26
for d in range(D):
    print(d % 26 + 1)

Solution (Python):
D = int(input())
c = list(map(int, input().split()))
s = []
for i in range(D):
  s.append(list(map(int, input().split())))
  
sdictlist = []
sdictlistsorted = []
for i in range(D):
  onedict = {}
  for j in range(26):
    onedict[j] = s[i][j]
  sdictlist.append(onedict)
  onesorteddict = sorted(onedict.items(), key=lambda x:x[1], reverse=True)
  sdictlistsorted.append(onesorteddict)

lenpastmax = 25
pastlist = []
for i in range(D):
  j = 0
  while(sdictlistsorted[i][j][0] in pastlist):
    j += 1
  print(sdictlistsorted[i][j][0]+1)
  pastlist.append(sdictlistsorted[i][j][0])
  if(len(pastlist)==lenpastmax):
    pastlist.pop(0)

Solution (Python):
d = int(input())
c = list(map(int, input().split()))
x = [0] * 26
y = [0] * 26
for _ in range(d):
    s = list(map(int, input().split()))
    for i in range(26):
        x[i] += c[i]
        y[i] = s[i] - x[i]
    ans = y.index(max(y)) + 1
    print(ans)
    x[ans - 1] = 0

Solution (Python):
def main():
    D = int(input())
    C = list(map(int, input().split()))
    S = [list(map(int, input().split()))for _ in range(D)]

    len_C = len(C)
    types = []
    lasts = [0] * 26

    for i in range(D):
        s = max(S[i])

        c = []
        c_sum = 0
        for j in range(len_C):
            c.append((i + 1 - lasts[j]) * C[j])
            c_sum += (i + 1 - lasts[j]) * C[j]  

        if c_sum >= s:  
            t = c.index(max(c)) + 1
            lasts[t - 1] = i + 1
        else:
            t = S[i].index(s) + 1

        types.append(t)

    for type in types:
        print(type)


if __name__ == '__main__':
    main()

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
SS = [list(map(int, input().split())) for i in range(D)]

Last = [-1] * 26


for d in range(D):
    S = SS[d]
    t = -1
    x = -1e100
    minus=sum(c * (d-max(last, 0)) for c, last in zip(C, Last))
    for i, s in enumerate(S):
        score = s - minus + C[i] * (d - max(Last[i], 0))

        if score > x:
            x = score
            t = i

    print(t + 1)

Solution (Python):


D = int(input())
C = list(map(int, input().split()))
L = [0 for _ in range(26)]

for _ in range(1,D+1):
  S = list(map(int, input().split()))
  contest_index = -1
  contest_manzoku = -10**9
  for i in range(26):
    i_manzoku = S[i]+C[i]+L[i]
    if i_manzoku > contest_manzoku:
      contest_index = i
      contest_manzoku = i_manzoku
  print(contest_index+1)
  for i in range(26):
    if i==contest_index:
      L[i] = 0
    else:
      L[i] += C[i]

Solution (Python):
D = int(input())
c = list(map(int,input().rstrip().split(" ")))
s = []
kankaku = [0 for i in range(27)]
for i in range(D):
    s.append(list(map(int,input().rstrip().split(" "))))

for i in range(D):
    p = 0
    t = 0
    for i2 in range(26):
        if p < s[i][i2] + c[i2] * kankaku[i2] * (kankaku[i2] * 2) // 2:
            p = s[i][i2] + c[i2] * kankaku[i2] * (kankaku[i2] * 2) // 2
            t = i2 + 1
    kankaku[t - 1] = -1
    print(t)
    for i in range(26):
        kankaku[i] += 1

Solution (Python):
import random

D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(D)]

plus=0
minus=0
data=[[1 for i in range(D)] for j in range(26)]
ans=[0]*D
for i in range(D):
    t=random.randint(1,26)
    ans[i]=t
    plus+=s[i][t-1]
    if i!=0:
        for j in range(26):
            data[j][i]=data[j][i-1]+1
    data[t-1][i]=0
    minus+=sum(c[j]*data[j][i] for j in range(26))

eval=plus-minus
count=1000
while count:
    d=random.randint(1,D)
    q=random.randint(1,26)
    if ans[d-1]==q:
        continue
    testplus=plus+s[d-1][q-1]-s[d-1][ans[d-1]-1]
    testminus=minus
    pre=ans[d-1]
    
    "ans[d-1]=q"

    day=0
    for j in range(d-1,D):
        if data[q-1][j]!=0:
            if j==d-1:
                testminus+=day*c[q-1]-data[q-1][d-1]*c[q-1]
            else:
                testminus+=(day+1-data[q-1][j])*c[q-1]
                day+=1
        else:
            break

    day=0
    for j in range(d-1,D):
        if j==d-1:
            if j==0:
                day=1
                testminus+=c[pre-1]*day
            else:
                day=1+data[pre-1][j-1]
                testminus+=c[pre-1]*day
        elif data[pre-1][j]!=0:
            testminus+=(day+1-data[pre-1][j])*c[pre-1]
            day+=1
        else:
            break

    if testplus-testminus>eval:
        eval=testplus-testminus
        plus=testplus
        minus=testminus
        ans[d-1]=q
        for j in range(d-1,D):
            if data[q-1][j]!=0:
                if j==d-1:
                    data[q-1][d-1]=0
                else:
                    data[q-1][j]=data[q-1][j-1]+1
            else:
                break

        for j in range(d-1,D):
            if j==d-1:
                if j==0:
                    data[q-1][j]=1
                else:
                    data[q-1][j]=1+data[pre-1][j-1]
            elif data[pre-1][j]!=0:
                data[q-1][j]=data[q-1][j-1]+1
            else:
                break
    count-=1

for i in range(D):
  print(ans[i])

Solution (Python):
from random import randint

D = int(input())
C = [int(i) for i in input().split()]
scores = [[int(i) for i in input().split()] for j in range(D)]
print("\n".join(map(str, [randint(1,26) for i in range(D)])))

Solution (Python):
import numpy as np
ans=0
D=int(input())
C=np.array(list(map(int,input().split())))
last_day=np.array([0 for _ in range(26)])

for day in range(1,D+1):
    score=np.array(list(map(int,input().split())))
    tmp=C*(last_day-day)
    
    idx=np.argmax(tmp+score)
    
    last_day[idx]=day
    print(idx+1)

Solution (Python):

from copy import deepcopy
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]

last = {}
for i in range(26):
    last[i] = -1

s = 0
for d in range(D):
    ret = 0
    sr = {}
    for c in range(26):
        last_cp = deepcopy(last)
        s_cp = deepcopy(s)
        last_cp[c] = d
        s_cp += S[d][c]
        for i in range(26):
            s_cp -= C[i] * (d-last[i])
        sr[c] = s_cp
    sr = sorted(sr.items(), key=lambda x:x[1])
    s += sr[-1][1]
    ret = sr[-1][0]
    print(ret+1)

Solution (Python):
D = int(input())
N = 26
c = [int(i) for i in input().split()]
last = [0 for i in range(N)]
s = list()
for i in range(3):
  s.append([int(j) for j in input().split()])
  
for i in range(D-3):
  d_score = -1
  ans = -1
  ans_d = -1
  for j in range(N):
    last_day = (i + 1 - last[j])
    arg = s[0][j] + c[j]*last_day
    if d_score < arg and s[0][j] > s[1][j] and s[0][j] > s[2][j]:
      d_score = arg
      ans = j+1
    if d_score < arg:
      ans_d = j+1
  if ans == -1:
    ans = ans_d
  print(ans)
  del s[0]
  s.append([int(j) for j in input().split()])
  last[ans-1] = i+1
for i in range(3):
  d_score = -1
  ans = -1
  for j in range(N):
    last_day = i + 1 - last[j]
    arg = s[i][j] + c[j]*last_day
    if d_score < arg:
      d_score = arg
      ans = j+1
  print(ans)
  last[ans-1] = i+1

Solution (Python):
import random
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
ans = 0
last = [0]*26
for i in range(1,d+1):
    res = -float("inf")
    index = 0
    for k in range(26):
        x = k
        tnplast = last
        tnplast[x] = i
        tnp = 0
        tnp += s[i-1][x]
        for j in range(26):
            tnp -= c[j]*(i-last[j])
        if (tnp > res):
            res = tnp
            index = k+1
    ans += res
    print(index)

Solution (Python):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque


from collections import Counter

from itertools import accumulate,combinations,permutations

from heapq import heapify,heappop,heappush


from functools import lru_cache

from decimal import Decimal
import random
def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(x):print(x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    

    D = int(input())
    
    cs = tuple(map(int, input().split())) 
    
    S = tuple(tuple(map(int, input().split())) for i in range(D)) 
    ls=[0]*26
    anss=[-1]*D
    for i in range(D):
        s=S[i]
        if i==0:
            msc=-1000000
            ans=-1
            for j in range(26):
                sc=s[j]+cs[j]

                if msc<sc:
                    ans=j
                    msc=sc
            ls[ans]=1

            anss[i]=ans+1
            continue
        msc=0
        ans=-1
        dec=[-cs[j]*(i+1-ls[j]) for j in range(26)]
        msc=-10000000
        ans=-1
        for j in range(26):
            sc=s[j]-dec[j]
            if msc<sc:
                ans=j
                msc=sc
        ls[ans]=i+1
        anss[i]=ans+1
    
    def eval(anss):
        ls=[0]*26
        score=0
        for i in range(D):
            j=anss[i]-1
            ls[j]=i+1
            score+=S[i][j]
            dec=sum([cs[k]*(i+1-ls[k]) for k in range(26)])
            score-=dec
        return score

    csc=eval(anss)
    nans=copy(anss)

    for _ in range(9000):
        target=random.randrange(0,D)
        val=random.randrange(0,26)+1
        pval=nans[target]
        nans[target]=val
        nsc=eval(nans)
        if nsc>csc:
            anss[target]=val
            csc=nsc
            
        else:
            nans[target]=pval
        

    printl(anss)
    
    

if __name__ == "__main__":
    main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    D = I()
    c = LI()
    s = LLIN(D)
    lst = [0] * 26
    for i in range(D):
        l = s[i]
        for j in range(26):
            lst[j] += c[j]
            l[j] += lst[j]
        if i < D - 2:
            l1 = s[i + 1]
            for j in range(26):
                l[j] += l1[j]
        ind = l.index(max(l))
        print(ind + 1)
        lst[ind] = 0




if __name__ == '__main__':
    main()

Solution (Python):
import time
import random
def score(a,c,s,d):
  l=[-1 for i in range(26)]
  r=0
  for i in range(d):
    l[a[i]]=i
    r+=s[i][a[i]]
    for j in range(26):
      r-=c[j]*(i-l[j])
  return r
  
st=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[]
l=[-1 for i in range(26)]
ld=[]
for i in range(d):
  ms=-10**9
  mt=None
  for j in range(26):
    js=c[j]*(i-l[j])+s[i][j]
    if ms<js:
      ms=js
      mt=j
  l[mt]=i
  ans.append(mt)
  ld.append([l[mt],d])
  if l[mt]>=0:
    ld[l[mt]][1]=i

os=score(ans,c,s,d)
nt=st
rate=100
while nt-st<1.50:
  nt=time.time()
  ri=random.randint(0,d-1)
  rj=random.randint(0,25)
  na=[ans[i] for i in range(d)]
  na[ri]=rj
  ns=score(na,c,s,d)
  if ns>os:
    os=ns
    ans=na


for i in ans:
  print(i+1)

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
last = [0] * 26
v = 0
    
for d in range(D):
    c_vlist = [0] * 26
    for t in range(26):
        c_last = last[:]
        c_v = v
        c_last[t] = d + 1
        c_v += S[d][t]
        c_v -= sum([C[tt] * (d + 1 - last[tt]) for tt in range(26)])
        c_vlist[t] = c_v
    
    f_t = c_vlist.index(max(c_vlist))
    print(f_t + 1)
    
    last[f_t] = d + 1
    v += S[d][f_t]
    v -= sum([C[tt] * (d + 1 - last[tt]) for tt in range(26)])

Solution (Python):
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]
for i in range(D):
  a=10**9
  b=0
  for j in range(26):
    if a>=(s[i][j]-c[j]*(D-i-1)):
      a=s[i][j]-c[j]*(D-i-1)
      b=j
  print(j+1)

Solution (Python):


import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    it = map(int, sys.stdin.read().split())
    D = next(it)
    C = [next(it) for i in range(26)]
    S = [[next(it) for i in range(26)] for i in range(D)]

    ans = []
    for i in range(D):
        ss = S[i]
        di, qi = 0, ss[0]
        for j in range(1, 26):
            if ss[j] > qi:
                di, qi = j, ss[j]
        ans.append(di+1)

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()

Solution (Python):
import random

D = int(input())
c_list = list(map(int, input().split()))
for i in range(D):
    S_list = list(map(int, input().split()))
for i in range(D):
    print(random.randint(1,26))

Solution (Python):
D=int(input())
*c,=map(int,input().split())
s=[]
for i in range(D):
    *x,=map(int,input().split())
    s.append(x)

def score(T):
    last=[-1]*26
    v=0
    for d in range(D):
        v+=s[d][T[d]-1]
        last[T[d]-1]=d
        for i in range(26):
            v-=c[i]*(d-last[i])
    return v

import random
best=0

for x in range(4000):
    if x==0:
        tmp=[random.randint(1, 26) for _ in range(D)]
        tbest=tmp
    else:
        tmp=[random.randint(1, 26) for _ in range(D)]
    if score(tmp)>best:
        tbest=tmp
    else:
        continue

for t in tbest:
    print(t)

Solution (Python):
from collections import defaultdict
d = int(input())
c = list(map(int,input().split()))
s = []
for i in range(d):
    s.append(list(map(int,input().split())))
dic = defaultdict(int)
for i in range(1,d+1):
    maxscore = 0
    maxcontest = -1
    for k in range(26):
        score = 0
        score += s[i-1][k-1]
        score += c[k]*(i-dic[k])
        if score > maxscore:
            maxscore = score
            maxcontest = k
    print(maxcontest+1)
    dic[maxcontest] = i

Solution (Python):
for i in range(1,366):
  print(5)
exit()

Solution (Python):
from time import time, sleep
from random import random
def inpl(): return list(map(int, input().split()))
start = time()
D = int(input())
C = inpl()
S = [inpl() for _ in range(D)]
X = [0]*D
res = []
max_score = -10**9

while (time() - start < 1.8):
    score = 0
    A = [[] for _ in range(26)]
    for i in range(D):
        X[i] = int(random()*26)
        A[X[i]].append(i)
    for i in range(26):
        s = -1
        for j in range(len(A[i])):
            a = A[i][j]
            n = a - s - 1
            score += S[a][i] - n*(n-1)*C[i]//2
            s = a
        n = D - 1 - s
        score -= n*(n-1)*C[i]//2
    if score > max_score:
        max_score = score
        res = [x for x in X]
for x in res:
    print(x+1)

Solution (Python):

import numpy as np
d=int(input())
c=np.array(list(map(int,input().split())))
s=[None]*d

cm=np.array([0]*26)
cd=np.array([0]*26)
for i in range(d):
  s[i]=list(map(int,input().split()))
s=np.array(s)
for j in range(d):  
  
  
  r_i=np.argmax(s[j])
  cd=c*cm
  if np.max(cd>s[i][r_i]):
    r_i=np.argmax(cd)
  
  for k in range(26):
    cm[k]+=1
  cm[r_i]=0
  r_i+=1
  print(r_i)

Solution (Python):
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
s = np.array([list(map(int, input().split())) for _ in range(D)])


def s1(c, s, last_date, di, i):
    score = s[di - 1][i]
    score -= 20 * c[i - 1] * (di - last_date[i - 1])
    return score


def f(D, c, s):
    last_date = np.zeros(26)

    t = []
    for di in range(1, D + 1):
        score_list = []
        for i in range(26):
            score_list.append(s1(c, s, last_date, di, i))

        select_index = score_list.index(max(score_list))
        t.append(select_index)
        last_date[select_index] = di

    return t


for ti in f(D, c, s):
    print(ti + 1)

Solution (Python):

import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


D = z()
C = zz()
S = defaultdict(list)
for i in range(D):
    S[i + 1] = zz()

never_held = []

arr = list(range(26))
C, arr = zip(*sorted(zip(C, arr), reverse=True))
for i in range(D):
    print(arr[i % 26]+1)

Solution (Python):
D=int(input())
c=[]
c=list(map(int,input().split()))
s=[]
for i in range(D):
    s.append(list(map(int,input().split())))

for i in range(D):
  print('8')

Solution (Python):
import copy

def calc(T):
    res = 0
    L = [0]*26
    for i in range(D):
        res += S[i][T[i]-1]
        L[T[i]-1] = i+1
        for j in range(26):
            res -= C[j]*(i+1-L[j])
    return res
    
D = int(input())
C = [int(c) for c in input().split()]
S = [[int(s) for s in input().split()] for _ in range(D)]

T = [0]*D
L = [0]*26
for i in range(D):
    p = -10**12
    for j in range(26):
        d = S[i][j]
        for k in range(26):
            if k == j:
                continue
            d -= C[k]*(i+1-L[k])
        if p < d:
            p = d
            idx = j+1
    T[i] = idx
        

p = calc(T)
            
for i in range(D):
    for j in range(26):
        temp = copy.deepcopy(T)
        temp[i] = j+1
        newp = calc(temp)
        if p < newp:
            T[i] = j+1
            p = newp
for i in range(D-1, -1, -1):
    for j in range(26):
        temp = copy.deepcopy(T)
        temp[i] = j+1
        newp = calc(temp)
        if p < newp:
            T[i] = j+1
            p = newp

for t in T:
    print(t)

Solution (Python):
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    d = int(readline())
    c = list(map(int, readline().split()))
    s = [list(map(int, readline().split())) for _ in range(d)]
    for i in range(d):
        print(s[i].index(max(s[i])) + 1)


if __name__ == '__main__':
    main()

Solution (Python):
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]

last=[0]*26


for d in range(1,D+1):
    ans=0
    for choice in range(1,27):
        ans_tmp=0
        ans_tmp+=s[d-1][choice-1]
        for i in range(26):
            if i+1==choice:
                continue
            ans_tmp-=c[i]*(d-last[i])
        if ans_tmp>ans:
            case=choice
            ans=ans_tmp
    last[case-1]=d
    print(case)

Solution (Python):
for i in range(365):
 print(1)

Solution (Python):
import random
import time
import copy
start=time.time()
d=int(input())
c=list(map(int, input().split()))
s=[]
solution=[]
last=[0]*26
sco=0
for i in range(d):
  s.append(list(map(int, input().split())))
for day in range(1,d+1):
  man=[]
  for i in range(26):
    man.append(s[day-1][i]+last[i]*c[i])
  con=man.index(max(man))
  sco+=s[day-1][con]
  last[con]=day
  for (i,j) in zip(last,c):
    sco-=i*j
  solution.append(con)

while time.time()-start<1.9:
  sc=0
  sol=copy.deepcopy(solution)
  sol[random.randrange(d)]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,c):
      sc-=i*j
  if sc>sco:
    solution=sol
    sco=sc
for i in solution:
  print(i+1)

Solution (Python):
d = int(input())
c = [int(i) for i in input().split()]
s = [[int(i) for i in input().split()] for j in range(d)]



for i in range(d):
    print(1)
    
exit()

ans = []
last = [[0 for i in range(26)] for j in range(27)]
tmp_ans = [0]*26

for i in range(1,d+1):
    tmp_num = 0
    for j in range(26):
        tmp_ans[j] += s[i-1][j]
        last[j+1][j] = i
        for k in range(26):
            tmp_ans[j] -= (i-last[j+1][k])*c[k]
    idx = tmp_ans.index(max(tmp_ans))
    for j in range(26):
        for k in range(26):
            if k == idx:
                continue
            last[k][j] = last[idx][j]
    print(idx+1)
    

    """
            
    ans += s[i-1][t[i-1]-1]
    last[t[i-1]-1] = i
    for j in range(26):
        ans -= (i-last[j])*c[j]
    print(ans)
    """

Solution (Python):
D=int(input())
c=list(map(int,input().split()))
last=[0 for i in range(26)]
cost=[0 for i in range(26)]
degree=[0 for i in range(26)]
s=[]
for _ in range(D):
  s.append(list(map(int,input().split())))

for d in range(D):
  for i in range(26):
    cost[i]=c[i]*(d-last[i])
    degree[i]=s[d][i]-cost[i]
  k=degree.index(max(degree))
  last[k]=d
  print(k+1)

Solution (Python):
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(d)]
for i in range(d):
    cand=0
    for j in range(26):
        if s[i][cand]<s[i][j]:
            cand=j
    print(cand+1)

Solution (Python):
import sys
input=sys.stdin.readline
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
    sub=list(map(int,input().split()))
    s.append(sub)

last=[-1]*26
import random

for i in range(d):
    print(random.randint(1,26))

Solution (Python):
import sys
import random

sys.setrecursionlimit(500000)
def input():
    return sys.stdin.readline()[:-1]

D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]




def content(t):
    cont = 0
    last = [0]*26
    for i in range(D):
        cont += s[i][t[i]-1]
        last[t[i]-1] = i+1
        for j in range(26):
            cont -= c[j]*(i+1-last[j])
    return cont

def main():
    t = [random.randint(1,26) for i in range(D)]
    
    
    
    
    
    
    
    
    
    
    for a in t:
        print(a)


if __name__ == '__main__':
    main()