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):
from time import time
import random
random.seed(0)

now = time()

MAX = 26

d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [i % MAX + 1 for i in range(d)]

last = [0] * MAX

score = 0
for day, e in enumerate(t, 1):
    score += s[day-1][e-1]
    last[e-1] = day

    for ec, elast in zip(c, last):
        score -= ec * (day - elast)

while time() - now <= 1.8:
    prev_score = score

    ed = random.randint(1, d)
    eq = random.randint(1, MAX)

    q_old = t[ed-1]
    d_prev = {q_old: 0, eq: 0}

    c_old = c[q_old-1]
    c_new = c[eq-1]

    for day, e in enumerate(t, 1):
        if e in d_prev.keys():
            d_prev[e] = day

        score += c_old * (day - d_prev[q_old])
        score += c_new * (day - d_prev[eq])

    score -= s[ed-1][q_old-1]
    score += s[ed-1][eq-1]

    t[ed-1] = eq

    d_prev = {q_old: 0, eq: 0}

    for day, e in enumerate(t, 1):
        if e in d_prev.keys():
            d_prev[e] = day

        score -= c_old * (day - d_prev[q_old])
        score -= c_new * (day - d_prev[eq])

    if prev_score > score:
        t[ed-1] = q_old
        score = prev_score

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

Solution (Python):
d=int(input())
C=sorted((c,e) for e,c in enumerate(map(int,input().split())))[::-1]
l,m,r=C[:9],C[9:18],C[18:]
p=l+m+l+r+l+m
for i in range(d): print(p[i%len(p)][1]+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,1,lastday)
  Score=score
  lastday[choice]=i
  print(choice+1)

Solution (Python):
import math

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

nocontest = [1 for i in range(26)]

for i in range(D):
    s = S[i]
    contest = [0 for j in range(26)]
    for j in range(26):
        contest[j] = c[j] * nocontest[j] * s[j]
    
    max_contest = max(contest)
    ans = contest.index(max_contest)
    print(ans + 1)
    
    for j in range(26):
        if j == ans:
            nocontest[j] = 1
        else:
            nocontest[j] += math.sqrt(i+1)

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
s = []
p = [1]*d
for i in range(d):
    s.append(list(map(int,input().split())))
x = [1]*26
for i in range(d):
    q = 1
    m = -1
    for j in range(26):
        n = s[i][j] + x[j]*c[j]
        x[j] += 1
        if(m < n):
            m = n
            q = j
    x[q] *= 0
    p[i] = q+1
for i in range(d):
    print(p[i])

Solution (Python):
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]
last = [-1]*26
ans = 0
for i in range(D):
  TEMP = -float('inf')
  T = -1
  for t in range(26):
    temp = 0
    temp += s[i][t]
    tempo = last[t]
    last[t] = i
    temp -= sum([c[j]*(i-last[j]) for j in range(26)])
    
    if temp > TEMP:
      T = t
      TEMP = temp
    last[t] = tempo
  print(T+1)
  last[T-1] = i
  ans += TEMP

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

Solution (Python):
s = [i + 1 for i in range(26)] * 30
s = s[:365]
for a in s:
    print(a)

Solution (Python):
import sys

input=sys.stdin.readline
from random import randint
d=int(input().rstrip())
c=[int(i)for i in input().split()]
s=[[int(i)for i in input().split()]for _ in range(d)]
last=[0]*26
for i in range(d):
    print(randint(1,26))

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

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):
        opt_delta_satis = -10 ** 32
        opt_idx = 0
        for idx in range(TYPE_NUM):
            val = s[d, idx]
            org = last[idx]
            last[idx] = d+1
            temp_delta_satis = np.sum(-c*(d+1-last)) + val
            if opt_delta_satis < temp_delta_satis:
                opt_delta_satis = temp_delta_satis
                opt_idx = idx
            last[idx] = org
        last[opt_idx] = d+1
        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 _ in range(D)]    





typ=0
ans=0

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

Solution (Python):
from bisect import bisect_left
from random import randint
D = int(input())
Cs = list(map(int, input().split()))
Sss = []
for _ in range(D):
    Ss = list(map(int, input().split()))
    Sss.append(Ss)

def change(d, afterIdx):
    global score
    i = d - 1
    beforeIdx = Ts[i] - 1
    afterIdx -= 1
    if beforeIdx == afterIdx:
        return

    newScore = score

    before = lasts[beforeIdx]
    
    k1 = bisect_left(before, d)
    w = before[k1+1] - d
    h = d - before[k1-1]
    newScore -= Sss[i][beforeIdx]
    newScore -= w * h * Cs[beforeIdx]

    after = lasts[afterIdx]
    
    k2 = bisect_left(after, d)
    w = after[k2] - d
    h = d - after[k2-1]
    newScore += Sss[i][afterIdx]
    newScore += w * h * Cs[afterIdx]

    if newScore > score:
        lasts[beforeIdx].pop(k1)
        lasts[afterIdx].insert(k2, d)
        Ts[i] = afterIdx + 1
        score = newScore

Ts = []
for _ in range(D):
    Ts.append(randint(1, 26))

score = 0
lasts = [[0] for _ in range(26)]
for i, t in enumerate(Ts):
    d = i + 1
    t -= 1
    score += Sss[i][t]
    lasts[t].append(d)
    for j in range(26):
        score -= (d - lasts[j][-1]) * Cs[j]

for i in range(26):
    lasts[i].append(D+1)


for i in range(1000000):
    change(randint(1, D), randint(1, 26))

for t in Ts:
    print(t)

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

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

Solution (Python):
import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def tami(now, ContestType):
  res = c[ContestType] * (now - LastDay[ContestType])
  return res

def nasu(now, x, y, z):
  res = 0
  res += s[now-1][x]
  res += s[now][y]
  res += s[now+1][z]
  if x == y == z:
    res += (D - now) * ((D - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * (1 * c[y])
    now += 1
    res += (D - now) * (1 * c[z])
  elif x == y:
    res += (D - now) * ((D - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * (1 * c[y])
    now += 1
    res += (D - now) * ((D - LastDay[z]) * c[z])
  elif y == z:
    res += (D - now) * ((D - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * ((D - LastDay[y]) * c[y])
    now += 1
    res += (D - now) * (1 * c[z])
  elif x == z:
    res += (D - now) * ((D - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * ((D - LastDay[y]) * c[y])
    now += 1
    res += (D - now) * (2 * c[z])
  else:
    res += (D - now) * ((D - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * ((D - LastDay[y]) * c[y])
    now += 1
    res += (D - now) * ((D - LastDay[z]) * c[z])
  return res

D = I()
c = IL()
s = [IL() for i in range(D)]

LastDay = [0]*26
for i in range(1,D+1-3):
  tmp = ["", 0]
  for x in range(26):
    for y in range(26):
      for z in range(26):
        score = nasu(i, x, y, z)
        if tmp[1] < score:
          tmp = [x, score]
  LastDay[x] = i
  print(tmp[0]+1)
else:
  tmp = ["", 0]
  for x in range(26):
    for y in range(26):
      for z in range(26):
        score = nasu(i, x, y, z)
        if tmp[1] < score:
          tmp = [(x, y, z), score]
  for i in tmp[0]:
    print(i+1)

Solution (Python):

def get_score(day, contest, prev_list, loss_list, satisfied_matrix):
    plus = satisfied_matrix[day][contest]
    minus = 0
    for type, prev in enumerate(prev_list):
        if type == contest:
            continue
        spend = day - prev
        minus += loss_list[type] * spend

    return plus - minus



days = int(input())
loss_list = list(map(int, input().split()))
satisfied_matrix = [list(map(int, input().split())) for _ in range(days)]

prev_list = [-1] * 26

ans = []
for day in range(days):
    best_contest = 0
    best_score = 0
    for contest in range(26):
        score = get_score(day, contest, prev_list, loss_list, satisfied_matrix)
        if score > best_score:
            best_contest = contest
            best_score = score

    ans.append(best_contest+1)
    prev_list[best_contest] = day

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

Solution (Python):


D = int(input())

C = [int(y) for y in input().split()]

S = []

k = 0

for i in range(365):
  k += 1
  if k <= 26:
    print("{}".format(k))
  else:
    k = 1
    print("{}".format(k))

Solution (Python):


from collections import defaultdict
from heapq import heappush, heappop
import sys
import numpy as np
from random import random

sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  


def debug(*x):
    print(*x)


def solve(D, CS, S):
    "void()"
    for i in range(D):
        print(S[i].argmax() + 1)


def solve2(D, CS, S):
    "void()"
    last = [-1] * 26
    for i in range(D):
        dscore = np.zeros(26)
        for j in range(26):
            dscore[j] += S[i, j]
            dscore[j] -= sum(CS[k] * (i - last[k])
                             for k in range(26) if j != k)

        j = dscore.argmax()
        print(j + 1)
        last[j] = i


def solve(D, CS, S):
    "void()"
    from time import perf_counter
    time = perf_counter()

    bestscore = 0
    bestanswer = None
    while perf_counter() - time < 1.5:
        answer = []
        last = [-1] * 26
        for i in range(D):
            dscore = np.zeros(26)
            if random() > 0.9:

                for j in range(26):
                    dscore[j] += S[i, j]
                    dscore[j] -= sum(CS[k] * (i - last[k])
                                     for k in range(26) if j != k)

                j = dscore.argmax()
            else:
                j = int(random() * 26)
            answer.append(j + 1)
            last[j] = i
        s = calcScore(answer, D, CS, S)
        if s > bestscore:
            bestscore = s
            bestanswer = answer
    print(*answer, sep="\n")


def calcScore(answer, D, CS, S):
    last = [-1] * 26
    score = 0
    for i in range(D):
        j = answer[i] - 1
        score += S[i, j]
        last[j] = i
        score -= sum(CS[j] * (i - last[j]) for j in range(26))
    return score


def main():
    D = int(input())
    CS = list(map(int, input().split()))
    S = np.int16(read().split())
    S = S.reshape((D, 26))

    
    solve(D, CS, S)


T = """
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
"""

OUT = """
1
17
13
14
13
"""


def _test():
    import doctest
    doctest.testmod()
    as_input(T)
    main()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())
    input = f.readline
    read = f.read


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', solve.__doc__.strip().split()[0])(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        
        
        from my_module import solve  
    elif sys.argv[-1] == "-t":
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    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=[]
    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])
        ans.append((ans_tmp,choice))
    _,case=max(ans)
    last[case-1]=d
    print(case)

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 init():
    cont = 0
    last = [0]*26
    t = []
    for i in range(D):
        max_c = 0
        max_i = -1
        for j in range(26):
            if max_c < s[i][j] + c[j]*(i+1-last[j]):
                max_i = j
                max_c = s[i][j] + c[j]*(i+1-last[j])
        t.append(max_i+1)        
        cont += s[i][t[i]-1]
        last[t[i]-1] = i+1
    return t,cont

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,prev = init()
    for i in range(7777):
        d,q = random.randint(0,D-1), random.randint(1,26)
        prev_t = t[d]
        t[d] = q
        now = content(t)
        if prev>content(t):
            t[d] = prev_t
        else:
            prev=now
    for a in t:
        print(a)


if __name__ == '__main__':
    main()

Solution (Python):
import sys,collections as cl,bisect as bs,random
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
	return list(map(int,input().split()))
def m(): 
	return map(int,input().split())
def onem(): 
	return int(input())
def s(x): 
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): 
	return " ".join(map(str,x))
def max2(x): 
	return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

d = onem()

c = l()

s = []
for i in range(d):
	s.append(l())
	s[-1] = [[s[-1][i],i+1] for i in range(26)]
	s[-1].sort(reverse = True)
	print(s[-1][random.randrange(1,10)-1][1])
day = [0 for i in range(26)]

c = [[c[i],i] for i in range(26)]
c.sort(reverse = True)

Solution (Python):
import sys
import copy
import time
import random

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

D = None
C = None
S = None

def cnt_score(t):
    global D, C, S
    score = 0
    cnt = [-1] * 26

    for i in range(D):
        score += S[i][t[i] - 1]
        minusscore = 0
        cnt[t[i] - 1] = i
        for j in range(26):
            minusscore += (i - cnt[j]) * C[j]
        score -= minusscore
    return score


def main():
    global D, C, S
    D = int(input())
    C = [int(x) for x in input().split()]
    S = [[int(x) for x in input().split()] for _ in range(D)]

    start = time.time()

    ans = []
    for s in S:
        ans.append(C.index(max(C)) + 1)

    
    while True:
        
        current = time.time()
        if current - start > 1.0:
            break

        
        new_ans = []
        for _ in range(D):
            new_ans.append(random.randint(1, 26))

        if cnt_score(new_ans) > cnt_score(ans):
            ans = new_ans

    

    day = 0
    while True:
        
        current = time.time()
        if current - start > 1.8:
            break

        
        new_ans = copy.deepcopy(ans)
        old_score = cnt_score(ans)

        max_sore = old_score
        max_contest = ans[day]
        for i in range(26):
            new_ans[day] = i + 1
            new_score = cnt_score(new_ans)
            if new_score > old_score:
                max_contest = i + 1
                old_score = new_score
        ans[day] = max_contest

        
        day = (day + 1) % D

    for a in ans:
        print(a)



if __name__ == '__main__':
    main()

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))
resent_contests = []
C, arr = zip(*sorted(zip(C, arr), reverse=False))
i = 0
for d in range(1, D+1):
    if (len(resent_contests) == 26):
        resent_contests = []
    tmp_arr = list(range(26))
    s, tmp_arr = zip(*sorted(zip(S[d], tmp_arr), reverse=True))
    j = 0
    while (tmp_arr[j]+1 in resent_contests):
        j += 1
    resent_contests.append(tmp_arr[j]+1)
    print(tmp_arr[j]+1)

Solution (Python):
import math

import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    d = int(ipt())
    c = [int(i) for i in ipt().split()]
    s = [[int(i) for i in ipt().split()] for _ in range(d)]
    ld = [-1]*26
    edval = [0]*26

    for i in range(d):
        edval = s[i]*1
        for j in range(26):
            dl = i-ld[j]
            edval[j] += c[j]*dl*(dl+1)//2*0.5
        v = edval.index(max(edval))
        ld[v] = i
        print(v+1)

    return

if __name__ == '__main__':
    main()

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
Ret = []
for d in range(D):
    ret = 0
    sr = {}
    ll = {}
    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
        ll[c] = last_cp
    sr = sorted(sr.items(), key=lambda x:x[1])
    ret = sr[-1][0]
    s += sr[-1][1]
    last = deepcopy(ll[ret])
    Ret.append(ret+1)

'''
print(Ret[0], end='')
for i in range(1, D):
    print('\n' + str(Ret[i]), end='')
'''

for r in Ret:
    print(r)