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):
import random


d = int(input())
c = list(map(int,input().split()))
s = []

class field:
    def __init__(self):
        self.ans = [-1 for i in range(365)]
        self.last = [-1 for i in range(26)]


    def score_day(self,day,type):
        inc = s[day][type]
        dec = 0
        for i in range(26):
            dec += c[i]*(day-self.last[i])

        return  inc-dec


for i in range(d):
    arr = list(map(int,input().split()))
    s.append(arr)

best_score = 0
alloc = []

F = field()
ans = 0
good = []
childs = 50
for day in range(d):
    if day == 0:
        tp_scores = []
        for j in range(25):
            prob = j
            befl = F.last[prob]
            F.last[prob] = day
            sc = F.score_day(day, prob)
            tp_scores.append([-sc, j,F.last.copy(),str(j)])

            F.last[prob] = befl

        tp_scores.sort()
        good = tp_scores
    else:
        tp_scores = []
        for i in range(min(childs,len(good))):
            befs = good[i][0]
            befp = good[i][1]
            befl = good[i][2]
            befa = good[i][3]
            F.last = befl
            for j in range(25):
                prob = j
                bt = F.last[prob]
                F.last[prob] = day
                sc = F.score_day(day,prob)
                tp_scores.append([befs-sc,j,F.last.copy(),befa+","+str(j)])

                F.last[prob] = bt

        tp_scores.sort()
        good = tp_scores[:childs]
















root = map(int,good[0][-1].split(","))

for r in root:
    print(r+1)

Solution (Python):
lastday=[-1]*26
def last(d):
  sum=0
  for i in range(26):
    sum+=c[i]*(d-lastday[i])
  return sum

def myFunc(i,Score,depth,lastday):
  tmp_score=Score
  tmp_max_choice=0
  tmp_score-=last(i)
  tmp_max_score=tmp_score
  tmp_deep_score=tmp_score
  
  for k,j in enumerate(s[i]):
    if depth==0 or i==D-1:      
      if tmp_max_score<tmp_score+j+c[k]*(i-lastday[k]):
        tmp_max_choice=k
        tmp_max_score=tmp_score+j+c[k]*(i-lastday[k])
    else:
      l=lastday.copy()
      l[k]=i
      score,choice=myFunc(i+1,tmp_score+j+c[k]*(i-lastday[k]),depth-1,l)
      if tmp_deep_score<score:
        tmp_max_choice=k
        tmp_max_score=tmp_score+j+c[k]*(i-lastday[k])
        tmp_deep_score=score

  return tmp_max_score,tmp_max_choice

D=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(D):
  s.append(list(map(int,input().split())))
Score=0
for i in range(D):
  score,choice=myFunc(i,Score,2,lastday)
  Score=score
  lastday[choice]=i
  print(choice+1)

Solution (Python):
D = int(input())
c = list(map(int, input().split()))
S = 0
s = []
dec_s = [0] * D
open_event = []

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

for s_sim in s:
  open_event.append(s_sim.index(max(s_sim)))

for num in open_event:
  print(num+1)

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

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
s = []
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
num = 1
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                ans -= c[max_index]*(num-day[max_index])
            max_index = j
        else:
            ans -= c[j]*(num-day[j])
    day[max_index] = num
    ans += large
    print(max_index+1)
    num += 1

Solution (Python):
import sys
from random import randint
from time import time
start = time()
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline


def get_sat():
    sat = 0
    when = [-1] * 26
    for i in range(d):
        sat += s[i][t[i]]
        when[t[i]] = i
        for j in range(26):
            sat -= c[j] * (i - when[j])
    return sat


d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [randint(0, 25) for i in range(d)]
ans = get_sat()
told = t[:]
while time() - start < 1.7:
    p, q = randint(0, d - 1), randint(0, 25)
    t[p] = q
    if ans <= get_sat():
        told = t[:]
    else:
        t = told[:]
for i in t:
    print(i+1)

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



index_set=set(range(26))
for d in range(D):
  max_index=-1
  max_sd=-1
  for i in index_set:
    if max_sd<smat[d][i]:
      max_index=i
      max_sd=smat[d][i]
      
  max_index2=-1
  max_sd2=-1
  for i in range(26):
    if max_sd2<smat[d][i]:
      max_index2=i
      max_sd2=smat[d][i]
      
  if max_index==max_index2:
    print(max_index+1)
    index_set.remove(max_index)
  else:
    if max_sd2>4*max_sd:
      print(max_index2+1)
    else:
      print(max_index+1)
      index_set.remove(max_index)      
      
  if not index_set:
    index_set=set(range(26))
  else:
    sum_c=0
    for i in index_set:
      sum_c+=clist[i]
    if sum_c==0:
      index_set=set(range(26))

Solution (Python):
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(d)]
C=sum(c)
tot=0
mem=[0]*26
for i in range(d):
	for j in range(26):
		s[i][j]-=c[j]
	a=max(s[i])
	b=s[i].index(a)
	print(b+1)

Solution (Python):
D = int(input())
A = [[0]*26]*D
S = 0
C = list(map(int,input().split()))
P = 0
ld =[0]*26
l = [0]*26
sp = 0
t = [0]*D
for i in range(D):
  A[i] = list(map(int,input().split()))
for j in range(D):
  maxvalue = max(A[j])
  index = A[j].index(maxvalue)
  for n in range(26):
    ld[n] = ld[n]+1
  sp = ld[index]
  ld[index] = 0 
  for k in range(26):
    l[k] = C[k]*ld[k]
  lmax =max(l)
  if 13*lmax > maxvalue:
    lindex = l.index(lmax)
    ld[index] = sp
    ld[lindex] = 0
    for m in range(26):
      l[m] = C[m]*ld[m]
  S = S+maxvalue-sum(l)
  t[j] = index+1
for num in range(D):
  print(str(t[num]))

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

Solution (Python):
d = int(input())
c = list(map(int, input().split()))
score = []
for i in range(d):
    score.append(list(map(int, input().split())))
for i in range(d):
    print(score[i].index(max(score[i])) + 1)

Solution (Python):
import random
import time
import copy
start=time.time()
d=int(input())
c=list(map(int, input().split()))
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
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,range(26)):
    sco-=cli[i][j]
  solution.append(con)

while time.time()-start<1.9:
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(10)]:
    sol[x]=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,range(26)):
      sc-=cli[i][j]
  if sc>sco:
    solution=copy.deepcopy(sol)
    sco=sc
for i in solution:
  print(i+1)

Solution (Python):
from random import randrange


def is_valid(ans_types: list, ans_val: int) -> bool:
    """ans_types(1-indexed)を選んだときに、
    答えがans_valになるかどうかを確かめる。"""
    res = 0

    tmp_last_days = {}
    for c_type in range(1, C_TYPES + 1):
        tmp_last_days[c_type] = 0
   
    for day in range(1, DAYS + 1):
        c_type = ans_types[day - 1]
        res += s[day][c_type]

        tmp_last_days[c_type] = day
        for c_type in range(1, C_TYPES + 1):
            res -= c[c_type] * (day - tmp_last_days[c_type])

    return res == ans_val


def search_max_point(day: int, last_days: dict):
    """day-1日目までに選んだコンテストが確定している状態で
    day日目にどのコンテストを選べば満足度を最適化できるか貪欲に探索する。
    dayは1-indexedに注意。
    返値として、選ぶコンテスト(1-indexed)、そのときに得られる満足度を返す。
    """
    max_val = -INF
    max_type = -1
    for c_type in range(1, C_TYPES + 1):
        tmp = s[day][c_type]
        for c_type2 in range(1, C_TYPES + 1):
            if c_type2 == c_type:
                continue
            tmp -= c[c_type2] * (day - last_days[c_type2])
        if max_val < tmp:
            max_val = tmp
            max_type = c_type
    return max_type, max_val


def change(ans_types: list, day: int, from_type: int, to_type:int):
    """day日目のコンテストをfrom_typeからto_typeに変更する。
    dayは1-indexed、選ぶコンテストは1-indexedに注意。
    返値として、そのときに得られる満足度の変化量を返す。
    """
    res_diff = 0
    res_diff = -s[day][from_type] + s[day][to_type]

    from_t = ans_types
    to_t = ans_types[0:]
    to_t[day - 1] = to_type

    l_day = {from_type: 0, to_type: 0}
    for day, type_c in enumerate(from_t):
        day += 1
        if type_c in l_day:
            l_day[type_c] = day
        for type_c2 in l_day:
            res_diff += c[type_c2] * (day - l_day[type_c2])

    l_day = {from_type: 0, to_type: 0}
    for day, type_c in enumerate(to_t):
        day += 1
        if type_c in l_day:
            l_day[type_c] = day
        for type_c2 in l_day:
            res_diff -= c[type_c2] * (day - l_day[type_c2])
    return res_diff


d = int(input())  
c = [0] + list(map(int, input().split()))
s = [[0 for i in range(27)]] + [[0] + list(map(int, input().split())) for i in range(d)]


DAYS = d
C_TYPES = 26
INF = 10 ** 18


last_days = {}
for c_type in range(1, C_TYPES + 1):
    last_days[c_type] = 0



ans_val = 0
ans_types = []
for day in range(1, DAYS + 1):
    c_type, val = search_max_point(day, last_days)
    ans_types.append(c_type)
    ans_val += val
    last_days[c_type] = day


if not is_valid(ans_types, ans_val):
    print(re)
    exit()




cnt = 0
while cnt < 1000:
    day = randrange(1, DAYS + 1)
    from_type = ans_types[day - 1]
    while True:
        to_type = randrange(1, C_TYPES + 1)
        if to_type != from_type:
            break
    diff = change(ans_types, day, from_type, to_type)
    if diff > 0:
        ans_types[day - 1] = to_type
        ans_val += diff
    cnt += 1
for i in ans_types:
    print(i)

Solution (Python):
def main():
    D = int(input())
    c = list(map(int, input().split()))
    last = [0] * 27
    for d in range(0, D):
        s = list(map(int, input().split()))
        max_s = max(s)
        index_s = s.index(max_s)
        print(26)


if __name__ == '__main__':
    main()

Solution (Python):
import random

for i in range(365):
	print(random.randrange(1,27))

Solution (Python):
import sys
import random
import time
import numpy as np

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def prob(e1,e2,T):
    if e2 < e1:
        return 1
    else:
        return np.exp((e1-e2)/T)

def solve():
    D = ni()
    c = nl()
    s = [nl() for _ in range(D)]
    m = 26
    start = time.time()
    dT = 0.995
    T = 200

    def calc(sche, m=26):
        last = [-1] * m
        ans = 0
        for i in range(D):
            t = sche[i]
            ans += s[i][t]
            last[t] = i
            for j in range(m):
                ans -= c[j] * (i - last[j])
        return ans

    def change(d, q, sc):
        b = sche[d]
        fq, bq = -1, D
        fb, bb = -1, D
        for i in range(d):
            if sche[i] == q:
                fq = i
            if sche[i] == b:
                fb = i
        for i in range(D-1, d, -1):
            if sche[i] == q:
                bq = i
            if sche[i] == b:
                bb = i
        sc += ((bb - d) * (bb - d - 1) // 2 + (d - fb) * (d - fb - 1) // 2) * c[b]
        sc += ((bq - fq) * (bq - fq - 1) // 2) * c[q]
        sc -= s[d][b]
        sc -= ((bq - d) * (bq - d - 1) // 2 + (d - fq) * (d - fq - 1) // 2) * c[q]
        sc -= ((bb - fb) * (bb - fb - 1) // 2) * c[b]
        sc += s[d][q]
        return sc

    sche = [0] * D
    for i in range(D):
        sche[i] = s[i].index(max(s[i]))
    sc = calc(sche)
    bestst = sche[:]
    best = sc

    while time.time() - start < 1.8:
        for _ in range(300):
            d = random.randint(0, D-1)
            q = random.randint(0, m-1)
            nsc = change(d, q, sc)
            if best < nsc:
                bestst = sche[:]
                best = sc
            if random.random() < prob(sc, nsc, T):
                sche[d] = q
                sc = nsc
        T *= dT
    prn([1 + x for x in bestst])

    return

solve()

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

def get_score(_type):
    last = [-1] * 26
    S = 0
    for d in range(D):
        S += s[d][_type[d]]

        last[_type[d]] = d
        for i in range(26):
            S -= c[i] * (d - last[i])

    return S

base_types = []
last = [-1] * 26
S = 0
for d in range(D):
    
    M = -float('inf')
    for tt in range(26):
        _last = last[:]
        tmp = s[d][tt]

        _last[tt] = d
        for i in range(26):
            tmp -= c[i] * (d - _last[i])

        if tmp > M:
            M = tmp
            M_tt = tt

    S += s[d][M_tt]

    last[M_tt] = d
    for i in range(26):
        S -= c[i] * (d - last[i])
    base_types.append(M_tt)


types = []
last = [-1] * 26
S = 0
for d in range(D):
    
    seq = []
    for tt in range(26):
        _last = last[:]
        tmp = s[d][tt]

        _last[tt] = d
        for i in range(26):
            tmp -= c[i] * (d - _last[i])

        seq.append([tmp, tt])

    seq.sort(reverse=True)

    for i in range(10):
        tt = seq[i][1]
        tmp = base_types[:]
        tmp[d] = tt

        types.append(tmp)

M = -float('inf')
for _type in types:
    MM = get_score(_type)
    if MM > M:
        ans = _type
        M = MM
for _ans in ans:
    print(_ans + 1)

Solution (Python):
D=int(input())
C=list(map(int,input().split()))
import sys
S=sys.stdin.readlines()
k=C.index(max(C))
for i in range(365):
  print((k+i)%26+1)

Solution (Python):
for i in range(365):
  print((i+18)%26+1)

Solution (Python):
import random

def calc(D, s, t):
  last = [0 for _ in range(26)]
 
  value = 0
  for i in range(D):
    day = i + 1
    value += s[i][t[i]-1]
    last[t[i]-1] = day
    for j in range(26):
      value -= c[j] * (day - last[j])
  return value

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [random.randint(1,26) for _ in range(D)]

val = calc(D, s, t)
for _ in range(1000):
  d_rand = random.randint(1,D)
  q_rand = random.randint(1,26)
  old = t[d_rand-1]
  t[d_rand-1] = q_rand
  if val > calc(D, s, t):
    t[d_rand-1] = old
  else:
    val = calc(D, s, t)
for i in range(D):
  print(t[i])

Solution (Python):


def main():
    import sys
    import numpy as np
    D = int(sys.stdin.readline())
    Dur = np.zeros(26)
    S = np.zeros((D, 26))
    C = np.array(list(map(int, sys.stdin.readline().split())))
    for i in range(D):
        S[i] = list(map(int, sys.stdin.readline().split()))

    for d in range(D):
        Dur += 1
        cand = 0
        score_mx = -10**30
        loss = np.sum(Dur*C)
        for i in range(26):
            sat = S[d, i]
            score = sat+loss-Dur[i]*C[i]
            if score > score_mx:
                score_mx = score
                cand = i
        
        Dur[cand]=0
        print(cand+1)  
main()

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
import numpy as np
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

D = ni()
c = na()
s = [na() for _ in range(D)]

sat = 0
last = [0] * 26

for d in range(D):
    li = []
    for k in range(26):
        last_t = last.copy()
        sat_t = sat
        j = k
        last_t[j] = d + 1
        for i in range(26):
            sat_t -= (d + 1 - last_t[i]) * c[i]
        sat_t += s[d][j]
        li.append(sat_t)
    sat = max(li)
    day = np.argmax(li)
    last[day] = d + 1
    print(day+1)

Solution (Python):
import copy
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]
A = [[0 for i in range(26)]]
B1 = []
B2 = []
AA = []
ans = 0
for i in range(D):
  K = []
  for k in range(26):
    c = 0
    for j in range(26):
      if j != k:
        c += C[j] * (i+1-A[-1][j])
    an = S[i][k]-c
    K.append([an, k+1])
  K.sort()
  a = K[-1][1]
  B = copy.copy(A[-1])
  B[a-1] = i+1
  A.append(B)
  ans += K[-1][0]
  AA.append(ans)
  B1.append(a)
  B2.append(K[-2][1])
c = 0
k = B2[-1] - 1
for j in range(26):
  if j != k:
    c += C[j] * (D-A[-2][j])
an = S[D-1][k]-c
if AA[-2] + an > AA[-1]:
  B1[-1] = k + 1
for i in range(D):
  print(B1[i])

Solution (Python):
import sys
input = sys.stdin.readline
import numpy as np
from numba import njit


def read():
    D = int(input().strip())
    C = np.fromstring(input().strip(), dtype=np.int32, sep=" ")
    S = np.empty((D, 26), dtype=np.int32)
    for i in range(D):
        s = np.fromstring(input().strip(), dtype=np.int32, sep=" ")
        S[i, :] = s[:]
    return D, C, S


@njit
def satisfaction(d, C, last):
    v = 0
    for i in range(26):
        v -= C[i] * ((d+1) - last[i])
    return v


@njit
def solve(D, C, S):
    last = np.zeros(26, dtype=np.int32)
    cumsat = 0
    for i in range(D):
        maxt = 0
        maxsat = -999999999
        basesat = satisfaction(i, C, last)
        for t in range(26):
            u = S[i, t] + C[t] * ((i+1) - last[t])
            sat = basesat + u
            if maxsat < sat:
                maxt = t
                maxsat = sat
        last[maxt] = i+1
        cumsat += sat
        print(maxt + 1)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Solution (Python):
import time
st=time.time()
d=int(input())
c=[0]+[int(j)for j in input().split()]
s=[[0]+[int(j)for j in input().split()]for i in range(d)]
s2=[sorted([[j,idx]for idx,j in enumerate(s[i])],reverse=True)for i in range(d)]
t=[i[0][1]for i in s2]
ans=0
p=1
q=t[0]-1
se=set()
while time.time()-st<1.8:
    if len(se)==26:
        p+=1
        if p>d:p=1
        se=set()
        q=t[p-1]
    se.add(q)
    l=[0]*27
    tmp=0
    pre=t[p-1]
    t[p-1]=q
    for i,j in enumerate(t,1):
        tmp+=s[i-1][j]
        l[j]=i
        for k in range(1,27):
            tmp-=(i-l[k])*c[k]
    if ans<tmp:
        ans=tmp
    else:
        t[p-1]=pre
    nextq=list(set(range(1,27))-se)
    if nextq!=[]:
        q=nextq[0]

for i in t:
    print(i)

Solution (Python):
import numpy as np
from time import time
start = time()
def scoring(c,s,t):
    score = 0
    from_last = np.zeros(26)
    for i in range(s.shape[0]):
        from_last = from_last+1
        score += s[i,t[i]-1]
        from_last[t[i]-1] = 0
        score = score - (c*from_last).sum()
    return score


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


t = []
for i in range(D):
    chosen = s[i,:].flatten().argmax()+ 1
    t.append(chosen)


score = scoring(c,s,t)
while time()-start < 1.85:
    i = np.random.randint(D)
    old = t[i]
    t[i] = np.random.randint(1,27)
    new_score = scoring(c,s,t)
    if new_score > score:
        score = new_score
    else:
        t[i] = old

for i in t:
	print(i)

Solution (Python):
import sys
from random import randint
input = sys.stdin.readline
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [i % 26 + 1 for i in range(D)]
last = [0] * 26
def score(day, score):
  for i in range(26): score -= (day - last[i]) * c[i]
  return score
def run(day):
  global last
  last = [0] * 26
  res = 0
  for d in range(day):
    contest = t[d]
    last[contest] = d + 1
    res = score(d + 1, res) + s[d][contest]
  return res


for d in range(1, D + 1):
  mx = -float("inf")
  mxx = randint(1, 27)
  for x in range(26):
    t[d - 1] = x
    res = run(d)
    if mx < res:
      mx = res
      mxx = x
  t[d - 1] = mxx
for d in range(1, D + 1):
  mx = -float("inf")
  mxx = t[d - 1]
  for x in range(26):
    t[d - 1] = x
    res = run(d)
    if mx < res:
      mx = res
      mxx = x
  t[d - 1] = mxx

for x in t: print(x + 1)

Solution (Python):
from random import *
D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
X=[0]*26
Y,Z=0,0
V,W=0,0
for i in range(D):
  for j in range(26):
    X[j]+=C[j]
  Y,Z=-1,-10**20
  for j in range(26):
    if Y==-1:
      V,W=Y,Z
      Y,Z=0,X[0]+S[i][0]
    if Z<X[j]+S[i][j]:
      V,W=Y,Z
      Y,Z=j,X[j]+S[i][j]
    elif W<X[j]+S[i][j]:
      V,W=j,X[j]+S[i][j]
  if randrange(0,20) or V==-1:
    X[Y]=0
    print(Y+1)
  else:
    X[V]=0
    print(V+1)

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(d)]
heru = [0 for _ in range(26)]
for i in range(d):
	print(i%26 + 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


for d in range(1,D+1):
    ans=[]
    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])*10
        ans.append((ans_tmp,choice))
    _,case=max(ans)
    last[case-1]=d
    print(case)

Solution (Python):
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())

D=N()
c=[0]+L()
s=[[0]*27]+[[0]+L() for i in range(D)]

dp=[]
T=[0]
ld=[0]*(27)
for i in range(1,D+1):
    ma=0
    t=0
    for j in range(1,27):
        tmp=s[i][j]+(i-ld[j])*(D-i+1)*c[j]
        if tmp>ma:
            ma=tmp
            t=j
    T.append(t)
    ld[t]=i
        
sc=sum(c)
def point():
    ld=[0]*(27)
    score=-sc*((D+1)*D//2)
    for i in range(1,D+1):
        t=T[i]
        score+=s[i][t]+(i-ld[t])*(D-i+1)*c[t]
        ld[t]=i
    return score

now=point()
import random
for i in range(400000):
    d1,q1=random.randrange(1,D+1),random.randrange(1,27)
    d2,q2=random.randrange(1,D+1),random.randrange(1,27)
    d3,q3=random.randrange(1,D+1),random.randrange(1,27)
    old1=T[d1]
    old2=T[d2]
    old3=T[d3]
    T[d1]=q1
    T[d2]=q2
    T[d3]=q3
    new=point()
    if new>now:
        now=new
    else:
        T[d1]=old1
        T[d2]=old2
        T[d3]=old3
        
for i in T[1:]:
    print(i)

Solution (Python):
import sys
import numpy as np

ri = lambda: int(sys.stdin.readline())
rl = lambda: list(map(int, sys.stdin.readline().split()))

D = ri()
c = np.array(rl())
s = np.array([np.array(rl()) for _ in range(D)])
t = []
for lis in s:
  tmp_list = lis ** 2 / c**0.2
  max_idx = np.argmax(tmp_list)
  t.append(max_idx)
  print(max_idx + 1)
exit()
t = np.array(t)

score = 0
li = np.zeros(26)
li_one = np.ones(26)
c_sum = sum(c)
d = 0
for i in t:
  li += li_one
  li[i] = 0
  tmp = sum(c*li)
  score += s[d][i] - tmp
  print(int(score))
  d += 1

Solution (Python):
def examA():
    def calc_score(d,k):
        rep = C[k]*(d-used[k]) + S[d][k]
        return rep

    N = 26
    D = I()
    C = LI()
    S = [LI()for _ in range(D)]
    ans = 0
    T = [-1]*D
    used = [0]*N

    for d in range(D):
        s = -inf
        t = -1
        for i in range(N):
            cur = calc_score(d,i)
            if cur>s:
                s = cur
                t = i

        T[d] = t

        ans += S[d][t]
        used[t] = d + 1
        for j in range(N):
            ans -= C[j] * (d + 1 - used[j])


    def local_search():
        def search(d, k):
            l = 0; r = D
            for i in range(d + 1, D):
                if T[i] == k:
                    r = i
                    break
            for i in range(0, d)[::-1]:
                if T[i] == k:
                    l = i + 1
                    break
            return l, r

        def calc_cost(d, k):
            return C[k] * (d + 1) * d // 2

        for _ in range(100000):
            d, q = random.randint(0,D-1), random.randint(0,N-1)

            old = deepcopy(T[d])
            T[d] = q

            old_l, old_r = search(d, old)
            new_l, new_r = search(d, q)

            change = S[d][q] - S[d][old] \
                     - (calc_cost(old_r - old_l, old) - calc_cost(d - old_l, old) - calc_cost(old_r - d - 1, old)) \
                     + (calc_cost(new_r - new_l, q) - calc_cost(d - new_l, q) - calc_cost(new_r - d - 1, q))

            if change<=0:
                T[d] = old
        return

    
    local_search()
    

    for t in T:
        print(t+1)

    return

def examB():
    N = 26
    D = I()
    C = LI()
    S = [LI()for _ in range(D)]
    T = [I()for _ in range(D)]
    ans = [0]*D
    used = [0]*N
    for i,t in enumerate(T):
        ans[i] += ans[i-1]
        t -= 1
        ans[i] += S[i][t]
        used[t] = i+1
        for j in range(N):
            ans[i] -= C[j]*(i+1-used[j])
    for v in ans:
        print(v)
    return

def examC():
    def calc_start():
        rep = [0] * D
        used = [0] * N
        for i, t in enumerate(T):
            rep[i] += rep[i - 1]
            rep[i] += S[i][t]
            used[t] = i + 1
            for j in range(N):
                rep[i] -= C[j] * (i + 1 - used[j])
        return rep

    def search(d,k):
        l = 0; r = D
        for i in range(d+1,D):
            if T[i]==k:
                r = i
                break
        for i in range(0,d)[::-1]:
            if T[i]==k:
                l = i + 1
                break
        return l, r

    def calc_cost(d,k):
        return C[k]*(d+1)*d//2

    N = 26
    D = I()
    C = LI()
    S = [LI()for _ in range(D)]
    T = [I()-1 for _ in range(D)]

    ans = calc_start()[D-1]

    

    M = I()
    for i in range(M):
        
        d, q = LI()
        d -= 1; q -= 1
        old = deepcopy(T[d])
        T[d] = q
        

        old_l, old_r = search(d,old)
        new_l, new_r = search(d,q)

        
        

        change = S[d][q] - S[d][old] \
                 - (calc_cost(old_r - old_l, old) - calc_cost(d-old_l, old) - calc_cost(old_r-d - 1, old))\
                 + (calc_cost(new_r - new_l, q) - calc_cost(d - new_l, q) - calc_cost(new_r - d - 1, q))

        ans += change

        print(ans)

    return


from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""