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 sys
input = sys.stdin.readline
import random
import time
import copy
from operator import itemgetter
time0=time.time()

D=int(input())
C=[0]+list(map(int,input().split()))
S=[0]+[[0]+list(map(int,input().split())) for i in range(D)]


CI=sorted([(v,i) for i,v in enumerate(C)],key=itemgetter(0),reverse=True)
CHO=[i for v,i in CI[:5]]

CHOICES=[[0]]
for i in range(1,D+1):
    SI=sorted([(v,i) for i,v in enumerate(S[i])],key=itemgetter(0),reverse=True)
    CHOICES.append([i for v,i in SI[:5]])
    
ANS=0
T=[0]
LAST=[0]*27
for day in range(1,D+1):
    SCORE=[-1<<30]*27
    for j in range(1,27):
        SC=0
        SC+=S[day][j]

        for k in range(1,27):
            if j==k:
                continue
            SC-=C[k]*(day-LAST[k])
        SCORE[j]=SC

    choose=SCORE.index(max(SCORE))
    T.append(choose)
    LAST[choose]=day

ANS=0
LAST=[[0]*27 for i in range(D+1)]
for day in range(1,D+1):
    for j in range(1,27):
        LAST[day][j]=LAST[day-1][j]
    t=T[day]
    ANS+=S[day][t]
    LAST[day][t]=day

    for j in range(1,27):
        ANS-=C[j]*(day-LAST[day][j])

MAX=ANS
MAXT=copy.deepcopy(T)
d=0
after_t=0

while time.time()-time0<1.77:
    BT=copy.deepcopy(T)
    BLAST=copy.deepcopy(LAST)
    BANS=ANS
    
    d=d%D+1
    after_t=random.choice(CHO+CHOICES[d])

    before_t=T[d]

    ANS+=S[d][after_t]-S[d][before_t]

    T[d]=after_t

    for day in range(d,D+1):
        if T[day]!=before_t:
            ANS+=C[before_t]*(day-LAST[day][before_t])
            LAST[day][before_t]=LAST[day-1][before_t]
            ANS-=C[before_t]*(day-LAST[day][before_t])
        else:
            break

    ANS+=C[after_t]*(d-LAST[d][after_t])
    LAST[d][after_t]=d

    for day in range(d+1,D+1):    
        if T[day]!=after_t:
            ANS+=C[after_t]*(day-LAST[day][after_t])
            LAST[day][after_t]=LAST[day-1][after_t]
            ANS-=C[after_t]*(day-LAST[day][after_t])

    if ANS*10000<MAX*9995:
        T=BT
        LAST=BLAST
        ANS=BANS
    elif ANS>MAX:
        MAX=ANS
        MAXT=copy.deepcopy(T)

print(*MAXT[1:])

Solution (Python):
from itertools import product

class ACS:
    def __init__(self, D, C, S):
        self.now = 1
        self.D = D
        self.satisfaction = 0
        self.sat_log = []
        self.C = C
        self.S = S
        self.last = [0]*26
    
    def hold_contest(self, T):
        self.satisfaction += self.S[self.now-1][T]
        self.last[T] = self.now

        for i in range(26):
            self.satisfaction -= self.C[i]*(self.now - self.last[i])
        
        self.sat_log.append(self.satisfaction)
        self.now += 1
    
    def choice_max(self):
        maxs, maxi = -(10**18), 0
        for i in range(26):
            s = self.score_check(i)
            if s >= maxs:
                maxs = s
                maxi = i
        return maxi

    def nd_choice_max(self, n):
        maxs, maxi = -(10**18), (0 for _ in range(n))
        for s in product(range(26), repeat=n):
            score = self.nd_score_check(s)
            if score >= maxs:
                maxs = score
                maxi = s
        return maxi



    def score_check(self, T):
        score = self.satisfaction + self.S[self.now-1][T]

        for i in range(26):
            if i != T:
                score -= self.C[i]*(self.now - self.last[i])
        return score

    def nd_score_check(self, Ts: list):
        last = self.last[::]
        score = self.satisfaction
        d = self.now
        
        
        for T in Ts:
            score += self.S[d-1][T]
            last[T] = d
            for i in range(26):
                score -= self.C[i]*(d - last[i])
            d += 1
        return score

        

    def _log(self):
        print(f"\nday {self.now}\n satisfaction: {self.satisfaction}")

        


D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for _ in range(D)]
n = 3

acs = ACS(D, C, S)

for d in range(D//n):
    next_contests = acs.nd_choice_max(n)
    
    for c in next_contests:
        acs.hold_contest(c)
        print(c+1)
    
next_contests = acs.nd_choice_max(D%n)
for c in next_contests:
    acs.hold_contest(c)
    print(c+1)

Solution (Python):
import time
import random
import math
def sigmoid(x):
  if x<-100:
    return 0
  return 1/(1+math.exp(-x))
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=300
while nt-st<1.70:
  nt=time.time()
  na=[ans[i] for i in range(d)]
  na[random.randint(1,d-1)]=random.randint(0,25)
  ns=score(na,c,s,d)
  if sigmoid((ns-os)/rate/((2-nt+st)**4))>random.random():
    os=ns
    ans=na
 
  


for i in ans:
  print(i+1)

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

import numpy as np

lastdi = [0 for i in range(26)]
ans_c = []

d = 0
while True:
  if d == D:
    break
  if d < D - 3:
    day_s = sdi[d]
    
    sloss = [day_s[i] + c[i]*(d - lastdi[i]) for i in range(26) ]
    ans = sloss.index(max(sloss))
    ans_c.append( ans+1 )
    
    for i in range(26):
      if i != ans:
        lastdi[i] += 1
    lastdi[ans] = d
    d += 1
    
  else:
    
    a = [sdi[d][i] + sdi[d+1][i2] + sdi[d+2][i3] - 3 * sum([c[k]*( d - lastdi[k] + 1) for k in range(26) if k not in [i,i2,i3]] )- 3*c[i] - c[i2]*(d+1+lastdi[i2]) - c[i3]*(2*d-2*lastdi[i3]) for i in range(26) for i2 in range(26) for i3 in range(26)]
    idx = a.index(max(a))
    best_i3 = idx % 26 + 1
    best_i2 = (idx // 26) % 26 + 1
    best_i1 = idx // 676 + 1
    
    ans_c.append(best_i1)
    ans_c.append(best_i2)
    ans_c.append(best_i3)
    lastdi[best_i1-1] = d
    lastdi[best_i2-1] = d+1
    lastdi[best_i3-1] = d+2
    
    d += 3

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

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

fuman=[0]*26

for i in range(d):
    if i<=5:
        p=s[i].index(max(s[i]))
        print(p+1)
    else:
        p=fuman.index(max(fuman))
        print(p+1)
        
    for j in range(26):
        fuman[j]+=c[j]
    fuman[p]=0

Solution (Python):
import numpy as np
from functools import partial
D = int(input())
C = list(map(int, input().split()))
B = np.array([0] * 26)
S = [list(map(int, input().split())) for _ in range(D)]

def calc_satisfaction(d, t):
    _B = np.array(B)
    _B[t-1] = d
    satiety = sum(C * (d - _B))
    return S[d-1][t-1] - satiety

satisfaction = 0
for d in range(1, D+1):
    f = partial(calc_satisfaction, d)
    t, satisfaction_d = max([(t, f(t)) for t in range(1, 27)], key=lambda x: x[1])
    B[t-1] = d
    satisfaction += satisfaction_d
    print(t)

Solution (Python):
dur=int(input())
c=list(map(int,input().split()))
d=[0]*26
r=1.2
for i in range(dur):
  t=0
  s=list(map(int,input().split()))
  m=-1<<64
  for j in range(26):
    alt=s[j]+r*c[j]*(i+1-d[j])+sum([-r*c[k]*(i+1-d[k]) for k in range(26)])
    if alt>m:
      m=alt
      t=j
  print(t+1)
  d[t]=i+1

Solution (Python):
import random

random.seed(0)

def calc_point(point_list, interval, choice):
    point = 0

    for i, day in enumerate(interval):
        point -= c[i] * day

    point += point_list[choice - 1]

    return point

d = int(input())

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

s = []

for _ in range(d):
    temp = list(map(int,input().split()))

    s.append(temp)

choices = [(i % 26) + 1 for i in range(d)]

interval = [0] * 26
result = 0

for i in range(d):
    choice = choices[i]

    interval = [x + 1 for x in interval]

    interval[choice - 1] = 0

    result += calc_point(s[i], interval, choice)

for _ in range(1000):
    temp_choices = choices.copy()
    temp_result = 0

    temp_choices[random.randint(0, d - 1)] = random.randint(1, 26)

    interval = [0] * 26
    
    for i in range(d):
        choice = temp_choices[i]

        interval = [x + 1 for x in interval]

        interval[choice - 1] = 0

        temp_result += calc_point(s[i], interval, choice)

    if temp_result > result:
        choices = temp_choices
        result = temp_result

for choice in choices:
    print(choice)

Solution (Python):
from random import randrange
import time
START_TIME = time.time()


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 = tuple([0] + list(map(int, input().split())))
s = tuple([tuple([0 for i in range(27)])] + [tuple([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 time.time() - START_TIME < 1.8:
    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


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

for i in ans_types:
    print(i)

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 = 70
badchild = 20
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]

        if len(tp_scores) > childs:
            rest =len(tp_scores)-childs
            pick = min(badchild,rest)
            sp = random.sample(range(childs,len(tp_scores)),pick)
            for sss in sp:
                good.append(tp_scores[sss])
















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

for r in root:
    print(r+1)

Solution (Python):
d = int(input())
cl = list(map(int, input().split()))
sl = []
for _ in range(d):
    sl.append(list(map(int, input().split())))

tl = []



last_di = [-1]*26
ans = 0
for day in range(d):
    
    
    
    
    coef = 5.0 - day/400.0
    best_t = 0
    best_t_val = -999999999999
    for t in range(26):
        curr_val = sl[day][t]*1
        for i in range(26):
            if i == t: continue
            curr_val -= (day-last_di[i])*cl[i]*coef
        if curr_val >= best_t_val:
            best_t = t
            best_t_val = curr_val
    tl.append(best_t+1)
    last_di[best_t] = day
    ans += best_t_val
    
    
    
    

for t in tl:
    print(t)

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
cmax = max(c)
for al in range(26):
  if c[al] == cmax:
    maxc = al
up = []
for _ in range(d):
  up.append(list(map(int,input().split())))
ans = [[-1] for _ in range(26)]
for i in range(d):
  ans[maxc].append(i)
task = [maxc for i in range(d)]







for al in range(26):
  ans[al].append(d)

import bisect
from random import random
from random import randrange
import math
scr = 0
for al in range(26):
  now = ans[al]
  l = len(now)
  for j in range(1,l):
    scr -= c[al] * (now[j]-now[j-1]-1) * (now[j]-now[j-1]) // 2
    
  for j in range(1,l-1):
    scr += up[now[j]][al]
    
  

est = 20000
for _ in range(200):
  for _ in range(1000):
    day = randrange(d)
    pre = task[day]
    pst = randrange(26)
    if pre == pst:
      continue
    bpre = bisect.bisect_left(ans[pre],day)
    bpst = bisect.bisect_left(ans[pst],day)
    bpre1 = ans[pre][bpre-1]
    bpre2 = ans[pre][bpre+1]
    bpst1 = ans[pst][bpst-1]
    bpst2 = ans[pst][bpst]
    
    
    
    
    tmp = 0
    tmp -= c[pre] * (day-bpre1) * (bpre2-day)
    
    tmp += c[pst] * (day-bpst1) * (bpst2-day)
    
    tmp -= up[day][pre]
    
    tmp += up[day][pst]
    
    
    r = random()
    exp = math.exp(tmp/est)
    if exp > r:
      
      
      ans[pre].remove(day)
      bisect.insort(ans[pst],day)
      
      
      task[day] = pst
      scr += tmp
      
    
  est -= 100

  
for x in task:
  print(x+1)

Solution (Python):
d = int(input())
c = list(map(int, input().split()))
prev = [0] * 26

for i in range(d):
  s = list(map(int, input().split()))
  cost = 10 ** 10
  ans = -1
  for j in range(26):
    tmp = 0
    for k in range(26):
      if j == k:
        continue
      tmp += c[k] * (i - prev[k])
    if tmp < cost:
      cost = tmp
      ans = j
  prev[ans] = i
  print(ans+1)

Solution (Python):
count=0
for i in range(365):
    print(count+1)
    count+=1
    if count+1==27:
        count=0

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

Solution (Python):
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int, input().split())) for l in range(D)]
last = [0]*26

def score_down(d):
    ans = 0
    for i in range(26):
        ans += c[i]*(d - last[i])
    return ans

for d in range(D):
    score = [(s[d][i] - score_down(d+1)) for i in range(26)]
    t = score.index(max(score))
    print(t+1)
    last[t] = d+1

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

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(500000):
    d1,q1=random.randrange(1,D+1),random.randrange(1,27)
    d2,q2=random.randrange(1,D+1),random.randrange(1,27)
    old1=T[d1]
    old2=T[d2]
    T[d1]=q1
    T[d2]=q2
    new=point()
    if new>now:
        now=new
    else:
        T[d1]=old1
        T[d2]=old2

for i in T[1:]:
    print(i)

Solution (Python):

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

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

D = int(input())
C = np.array(list(map(int,input().split())),dtype=np.int)
S = [list(map(int,input().split())) for i in range(D)]

sumC = sum(C)
def score(strategy):
    sat = 0
    last = np.zeros(26).astype(np.int)
    for i,ind in enumerate(strategy):
        last += 1
        last[ind] = 0
        sat -= np.sum(C * last)
        sat += S[i][ind]
    return sat


first = [i % 26 for i in range(D)]

ans = first
now_score = score(ans)

for i in range(2):
    
    for d in range(D):
        temp = ans[:]
        temp[d] = np.argmax(S[d])
        
        new_score = score(temp)
        if new_score > now_score:
            now_score = new_score
            ans = temp

for a in ans:
    print(a+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:
    max_c=0
    for i in index_set:
      max_c=max(max_c,clist[i])
    if max_c<10:
      index_set=set(range(26))

Solution (Python):
import numpy as np
from sys import argv
import time
np.random.seed(10)


def input_from_file():
    with open(argv[1], "r") as f:
        D = int(f.readline())
        C = np.array(f.readline().split(), dtype=int)
        S = tuple(tuple(map(int, f.readline().split())) for _ in range(D))
    return D, C, S


def input_from_console():
    D = int(input())
    C = np.array(input().split(), dtype=int)
    S = tuple(tuple(map(int, input().split())) for _ in range(D))
    return D, C, S


def greed(D, C, S):
    last = np.ones(26, dtype=int)
    ans = []
    for s in S:
        s = np.array(s)
        tmp = s + C * last
        i = np.argmax(tmp)
        last[i] = 0
        last += 1
        ans.append(i + 1)
    return ans


def calc_score(D, C, S, T):
    res = 0
    last = np.ones(26, dtype=int)
    for d, t in enumerate(T):
        t -= 1
        last[t] = 0
        score = S[d][t]
        score -= (C * last).sum()
        res += score
        last += 1
    return res


def output_to_file(ans):
    with open("output.txt", "w", newline="") as f:
        for a in ans:
            f.write("{}\n".format(a))


def main():
    start = time.time()
    lim = 1.800
    D, C, S = input_from_console()
    
    
    sol = greed(D, C, S)
    score = calc_score(D, C, S, sol)
    while True:
        d = np.random.randint(0, D)
        q = np.random.randint(1, 27)
        old = sol[d]
        sol[d] = q
        new_score = calc_score(D, C, S, sol)
        if new_score > score:
            score = new_score
        else:
            sol[d] = old
        if time.time() - start >= lim:
            break
    print(*sol, sep="\n")
    


if __name__ == "__main__":
    main()

Solution (Python):
import random
D = int(input())
C = input().split()
C = [int(c) for c in C]
S = []
for i in range(D):
  s = input().split()
  s = [int(j) for j in s]
  S.append(s)
T = [1] * D
def value():
  M = 0
  last = [0] * 26
  for d in range(1,D+1):
    N = 0
    t = T[d-1]
    last[t-1] = d
    
    for j in range(26):
      N = N + C[j]*(d-last[j])
    M = M + S[d-1][t-1] - N
  return(M)
Vmax = value()
Q = []
for i in range(10):
  Q.append([random.randint(1,D), random.randint(1,26)])
for i in range(10):
  Tprev = T
  T[Q[i][0]-1] = Q[i][1]
  V = value()
  if V > Vmax:
    Vmax = V
  else:
    T = Tprev
  

for t in T:
  print(t)

Solution (Python):

import random
random.seed(0)

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

answer = []
L = [0 for _ in range(26)]
for S in list_S:
  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
  answer.append(contest_index)
  for i in range(26):
    if i==contest_index:
      L[i] = 0
    else:
      L[i] += C[i]

def manzoku(A):
  score = 0
  L = [0 for _ in range(26)]
  for i in range(D):
    contest_index = A[i]
    for j in range(26):
      if j==contest_index:
        L[j] = 0
        score += list_S[i][contest_index]
      else:
        L[j] += C[j]
        score -= L[j] 
  return score

manzoku_now = manzoku(answer)
answer_tmp = [answer[i] for i in range(D)]
for j in range(2000):
  day = j%D
  contest = random.randrange(26)
  answer_tmp[day] = contest
  manzoku_tmp = manzoku(answer_tmp)
  if manzoku_now < manzoku_tmp:
    manzoku_now = manzoku_tmp
    answer[day] = contest
  else:
    answer_tmp[day] = answer[day]

for index in answer:
  print(index+1)

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


MOD = 10**9 + 7
INF = 2**31  





def score(D, C, S, T):
    last = [-1] * 26
    
    score = 0
    for d in range(D):
        
        score += S[d][T[d]]
        last[T[d]] = d
        for i in range(26):
            
            score -= C[i] * (d - last[i])
    return score


from random import choices, seed

D = a_int()
C = ints()
S = read_tuple(D)

candi = list(range(26))

bestscore = -INF
for i in range(3 * 10000):
    seed(i)
    T = choices(candi, k=D)
    tmpscore = score(D, C, S, T)
    if tmpscore > bestscore:
        bestscore = tmpscore
        ansT = T



print(*mina(*ansT, sub=-1), sep='\n')

Solution (Python):
import random
import time
import copy
import math
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)

stemp=1000000
etemp=10000
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(3)]:
    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]
  prob = math.exp((sco-sc)/tem())
  if 1-prob>random.random():
    solution=copy.deepcopy(sol)
    sco=sc
for i in solution:
  print(i+1)

Solution (Python):
import sys
import numpy as np
TYPE_NUM = 26
DAYS = 2

def resolve():

    inp = sys.stdin.readlines()
    D = int(inp[0])
    c = np.array(list(map(int, inp[1].split(' '))))
    s = []
    last = np.zeros(TYPE_NUM, dtype=int)
    types = []

    for i in range(2, len(inp)):
        s.append(list(map(int, inp[i].split(' '))))
    s = np.array(s, dtype=int)

    for d in range(D):
        temp_delta_satis = np.zeros([TYPE_NUM, TYPE_NUM], dtype=int)
        for idx in range(TYPE_NUM):
            val = s[d, idx]
            org = last[idx]
            last[idx] = d+1
            temp_delta_satis[:, idx] = np.sum(-c*(d+1-last)) + val
            if D != d+1:
                for idx2 in range(TYPE_NUM):
                    val2 = s[d+1, idx2]
                    org2 = last[idx2]
                    last[idx2] = d+2
                    temp_delta_satis[idx2, idx] += np.sum(-c*(d+2-last)) + val2
                    last[idx2] = org2
            last[idx] = org
        opt_idx = np.unravel_index(np.argmax(temp_delta_satis), temp_delta_satis.shape)[0]
        types.append(opt_idx+1)
    print(*types, sep='\n')

resolve()

Solution (Python):
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(1,27):
    last[i] = 0

for d in range(1,D+1):
    ans = [1,-float('inf')]
    for i in range(1,27):
        satisfaction = 0
        satisfaction += s[d-1][i-1]
        for j in range(1,27):
            if i != j:
                satisfaction -= c[j-1]*(d-last[j])
        if ans[1] <= satisfaction:
            ans = [i,satisfaction]
    last[ans[0]] = d
    print(ans[0])

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007




def main():
	D = inputInt()
	C = inputList()
	S = []
	ans = []
	for i in range(D):
		s = inputList()
		S.append(s)

	minC = min(C)
	minCn = 0
	for i,val in enumerate(C):
		if val == minC:
			minCn = i

	for i,val in enumerate(S):
		tmp = max(val)
		for j,vol in enumerate(val):
			if tmp == vol:
				ans.append(random.randint(1, 26))
				break

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



if __name__ == "__main__":
	main()