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=[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=150000
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):
def calc(D, C, S, T):
    s = 0
    l = [-1] * len(C)
    for d, t in enumerate(T):
        t -= 1
        s += S[d][t]
        s -= C[t] * (d - l[t]) * (d - l[t] - 1) // 2
        l[t] = d
    s -= sum(c * (d - l[i]) * (d - l[i] + 1) // 2 for i, c in enumerate(C))
    return s


def main():
    D = int(input())
    C = list(map(int, input().split()))
    S = [list(map(int, input().split())) for _ in range(D)]
    
    for i in range(D):
        print(S[i].index(max(S[i])) + 1)

main()

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

def decrease(clist,d,lastlist):
    sum = 0
    for i in range(26):
        sum += clist[i]*(d-lastlist[i])
    return sum

def calculate(d,clist,satisfactionlist,orderlist):
    satisfaction = 0
    lastlist = [0 for _ in range(26)]
    for j in range(d):
        i = orderlist[j]
        satisfaction += satisfactionlist[j][i-1]
        lastlist[i-1] = j+1
        satisfaction -= decrease(clist,j+1,lastlist)
    print(satisfaction)
    return satisfaction

orderlist = []

for day in range(d):
    combined1 = [x * y for (x, y) in zip(clist, satisfactionlist[day])]
    max_value = max(combined1)
    max_index = combined1.index(max_value)
    orderlist.append(max_index+1)



for ans in orderlist:
    print(ans)

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


Ans = 0 
last = [-1]*26


for d in range(D):
    max_ans = -999999999
    max_i = 0
    
    for contest_id in range(26):
        ans = 0
        
        ans += S[d][contest_id]
        
        for i in range(26):
            if i != contest_id:
                ans -= C[i]*(d - last[i])
        
        if ans > max_ans:
            max_ans = ans
            max_i = contest_id
    
    last[max_i] = d
    
    print(max_i + 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 = 26 
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=[int(i) for i in input().split()]
a=[]
for i in range(D):
    a.append([int(i) for i in input().split()])

last=[0 for i in range(26)]
zoku=0    
for d in range(D):
    print(a[d].index(max(a[d]))+1)

Solution (Python):
import numpy as np
D = int(input())
c = list(map(int,input().split()))
s=[]
f=[]
for i in range(D):
  if(i%26 == 0):
    f = [0]*26
  x = np.array(list(map(int, input().split())))
  for j in range(26):
    if(f[j]!=0):
      x.delete(1,j)
  s.append(x.argmax())
for i in range(D):
  print(s[i]+1)

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

t_start = time.perf_counter()

N = 26
D = int(input())

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

s_table = []
for _ in range(D):
	s_table.append(list(map(int, input().split())))

last = [-1] * N
data = []
satisfaction = 0
for i in range(D):
	max_c = 0
	max_s = None
	s_list = s_table[i]
	for j in range(N):
		s = s_list[j]
		for k in range(N):
			if k != j:
				s -= c_list[k] * (i - last[k])
		if max_s == None or s > max_s:
			max_s = s
			max_c = j
	data.append(max_c)
	satisfaction += max_s
	last[max_c] = i

print(satisfaction, file = sys.stderr)

def calc(data):
	last = [-1] * N
	satisfaction = 0
	for i in range(D):
		j = data[i]
		satisfaction += s_table[i][j]
		last[j] = i
		for k in range(N):
			satisfaction -= c_list[k] * (i - last[k])
	return satisfaction

def p(value_old, value_new, t):
	if value_new > value_old:
		return True
	else:


		return math.pow(math.e, (value_new - value_old) / t) > random.random()

def optimize(satisfaction, data):
	t_end = t_start + 1.8
	T = 10000
	d = 0.9999
	best = satisfaction
	best_data = list(data)
	tmp_data = list(data)
	while True:
		if time.perf_counter() > t_end:
			return best, best_data
		i = random.randrange(D)
		j = random.randrange(N)
		while j == data[i]:
			j = random.randrange(N)
		tmp_data[i] = j
		tmp_s = calc(tmp_data)


		if p(satisfaction, tmp_s, T):

			satisfaction = tmp_s
			data[i] = j
			if satisfaction > best:
				best = satisfaction
				best_data = list(data)

		T *= d

satisfaction, data = optimize(satisfaction, data)

print(calc(data), file = sys.stderr)

for j in data:
	print(j + 1)

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

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


class Problem:

    def __init__(self, D, s, c):
        self.last_days = [0] * 26
        self.D = D
        self.s = s
        self.c = c

    def scoring(self, day, ind):
        day_score = self.s[day - 1][ind]
        self.last_days[ind] = day
        minus_score = 0
        for i in range(26):
            minus_score += self.c[i] * (day - self.last_days[i])
        day_score -= minus_score
        return day_score

    def _strategy(self, day):
        ind = random.randint(0, 25)
        score = self.scoring(day, ind)
        return score, ind

    def solve(self):
        answer = []
        sum_score = 0
        for i in range(self.D):
            score, ind = self._strategy(i)
            answer.append(ind)
            sum_score += score
        return sum_score, answer

    def init(self):
        self.last_days = [0] * 26


def main():
    time_start = time.time()
    DO_TIME = 2
    D = int(input())
    c = list(map(int, input().split()))
    s = []

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

    max_score = 0
    max_answer = [1] * D
    problem = Problem(D, s, c)
    ite = 0
    while time.time() - time_start < DO_TIME * 0.9:
        ite += 1
        score, answer = problem.solve()

        if score > max_score:
            max_score = score
            max_answer = answer

    for i in range(D):
        max_answer[i] += 1
        print(max_answer[i])
    
    
    


main()

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())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
def Yes(x):print("Yes")if x==True else print("No")

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

dp=[]
T=[0]
for i in range(1,D+1):
    ma=0
    t=0
    for j in range(1,27):
        if s[i][j]>ma:
            ma=s[i][j]
            t=j
    T.append(t)
        
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(1000):
    d,q=random.randrange(1,D+1),random.randrange(1,27)
    old=T[d]
    T[d]=q
    new=point()
    if new>now:
        now=new
    else:
        T[d]=old
for i in T[1:]:
    print(i)

Solution (Python):

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

last = [0] * 27
manzoku = [0] * 27
for i in range(1, D+1):
    for j in range(1, 27):
        if last[j] != 0:
            manzoku[j] -= c[j] * (i - last[j])
    manzoku[s[i-1].index(max(s[i-1]))] += max(s[i-1])
    last[s[i-1].index(max(s[i-1]))] = i
    result = s[i-1].index(max(s[i-1])) + 1
    print(result)

Solution (Python):
D = int(input())
C = [int(i) for i in input().split()]
L = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
P = []
for d in range(D):
    s = [int(i) for i in input().split()]
    ans = 0
    ma = 0
    P.append(0)
    for j in range(26):
        tmp = s[j]
        for k in range(26):
            if k != j:
                tmp -= C[k] * (d + 1 - L[k])
        if tmp > ma:
            ma = tmp
            ans = j
    L[ans] = d + 1
    print(ans + 1)

Solution (Python):


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

def maxcontest(s):
    ans = -1
    for i in range(26):
        if ans <= s[i]:
            ans = s[i]
            num = i 
    return num+1

for i in range(d):
    print(maxcontest(s[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 s2(c, s, last_date, di, i):
    score = s[di - 1][i]
    score += 100 * c[i - 1] * (di - last_date[i - 1])
    return score


def f2(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(s2(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 f2(D, c, s):
    print(ti + 1)

Solution (Python):
import numpy as np

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

ans=[0]*d
for i in range(d):
  ans[i]=np.argmax(s[i]) + 1

for sd in ans:
	print(1)

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    D = int(readline())
    C = [int(i) for i in readline().split()]
    S = [[int(i) for i in readline().split()] for _ in range(D)]
    ans = []

    last = [0] * 26
    score = 0
    for i in range(D):
        kouho = []
        for t in range(26):
            tmp = score
            tmp += S[i][t]
            last_t = last[t]
            last[t] = i+1
            for j, c in enumerate(C):
                tmp -= c * (i+1 - last[j])
            kouho.append((tmp, t))
            last[t] = last_t

        score, ind = max(kouho)
        ans.append(ind + 1)
        last[ind] = i + 1
    
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

D = int(input())
C = list(map(int,input().split()))
S = [list(map(int,input().split())) for _ in range (D)]
M = 26
INF = 10**20

ans = [0]*D
lasts = [0]*(M+1)

for i in range(D):
    score = -INF
    contest = 0
    for m in range(1,M+1):
        cur = S[i][m-1]
        cur += C[m-1]*(i+1-lasts[m])
        if cur>score:
            score = cur
            contest = m
    ans[i] = contest
    lasts[contest] = i

for a in ans:
    print(a)

Solution (Python):
import random
[print(random.randint(1, 26)) for i in range(365)]

Solution (Python):
def _calc_today_max(today, Ci, Sdi, last_day):
    today_total_bad_value = \
        sum([Ci[contest] * (today + 1 - last_day[contest]) for contest in range(26)])

    max_value = -99999999999999999
    max_context = 0
    for contest in range(26):
        today_contest_value = Sdi[today][contest]
        today_bad_value = today_total_bad_value - (Ci[contest] * (today + 1 - last_day[contest]))
        today_value = today_contest_value - today_bad_value
        if max_value < today_value:
            max_value = today_value
            max_context = contest

    return max_context


def _main(D, Ci, Sdi):
    last_day = [0] * 26
    for today in range(D):
        max_contest = _calc_today_max(today, Ci, Sdi, last_day)
        print(max_contest + 1)
        last_day[max_contest] = today + 1


def _execute():
    D = int(input())
    Ci = list(map(int, input().split()))
    Sdi = []
    for i in range(D):
        Sdi.append(list(map(int, input().split())))
    _main(D, Ci, Sdi)


if __name__ == "__main__":
    _execute()

Solution (Python):


import sys
stdin = sys.stdin
import numpy as np

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    d = ni()
    c = np.array(na())
    s = list()
    for i in range(d):
        a = na()
        s.append(a)
    t = [i % 26 + 1 for i in range(d)]
    print(*t, sep="\n")

if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np

d = int(input())
c = list(map(int, input().split()))
c_sum = sum(c)
s = [[] for _ in range(d)]
for i in range(d):
  s[i] = list(map(int, input().split()))
  
last = [0 for _ in range(26)]
plan = [-1 for _ in range(d)]

def loss(today):
  sum = 0
  for i in range(26):
    sum += c[i-1] * (today - last[i-1])
  return sum
  
  
v = 0
for today in range(1, d+1):
  t = np.argmax([s[today-1][i] - c_sum + c[i] for i in range(26)])
  t += 1
  last[t-1] = today
  plan[today-1] = t
  print(t)

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
        best=score(tmp)
    else:
        continue
for t in tbest:
    print(t)

Solution (Python):
def max_(s, q, j):
  for i in range(1, q):
    if s[0][j] < s[i][j]:
      return False
  return True

D = int(input())
N = 26
c = [int(i) for i in input().split()]
last = [0 for i in range(N)]
s = list()
q = 7
for i in range(q):
  s.append([int(j) for j in input().split()])
  
for i in range(D-q):
  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 max_(s, q, 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(q):
  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):
D = int(input())
C = list(map(int, input().split()))
s = list()
for i in range(D):
  s1 = list(map(int, input().split()))
  s.append(s1)
t = [0] * D

def point(t, C, s):
  done = [0] * 26
  ans = 0
  for d in range(1, D+1):
    td = t[d-1]
    done[td] = d
    ans += s[d-1][td]
    for i in range(26):
      ans -= C[i]*(d-done[i])
  return ans

ans = 0
bettert = 0
for i in range(26):
  t[0] = i
  
  if(point(t, C, s) > ans):
    ans = point(t, C, s)
    bettert = i
    
print(bettert+1)
for i in range(D-1):
  print(1)

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


satisfaction = 0
last = [0]*26

for i in range(D):

    best_sat = satisfaction
    best_T = 0
    for t in range(26):
        t_sat = S[i][t] + satisfaction - \
                sum([C[k]*((i+1)-last[k]) for k in range(26)]) + C[t]*((i+1)-last[t])
        if t_sat > best_sat:
            best_T = t
            best_sat = t_sat

    saticfaction = S[i][best_T] \
                   + satisfaction - sum([C[k]*((i+1)-last[k]) for k in range(26)]) \
                   + C[best_T]*((i+1)-last[best_T])
    last[best_T] = i + 1
    
    
    print(best_T+1)

Solution (Python):


import sys
import math

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

lastday = [0] * 26
sat = 0
ans = [0] * D

for i in range(D):
  maxtmpsat = -1000000
  for j in range(26):
    tmpsat = s[i][j] + c[j] * (i+1 - lastday[j]) 
    if tmpsat > maxtmpsat:
      maxtmpsat = tmpsat
      ans[i] = j+1
  lastday[ans[i]-1] = i+1
  print(ans[i])

Solution (Python):
from random import randrange
stop=26

a=[ randrange(stop)+1 for i in range(365)]
for b in a:
    print(b)

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()))
  happy = - (10 ** 10)
  ans = -1
  for j in range(26):
    tmp = s[j]
    cost = 0
    for k in range(26):
      if j == k:
        continue
      cost += c[k] * (i - prev[k])
    tmp -= cost
    if tmp > happy:
      happy = tmp
      ans = j
  prev[ans] = i
  print(ans+1)

Solution (Python):
def yumiri(L, n):
  for i in range(len(L)):
    if L[i] > n:
      return i - 1

def naobou(d, q):
  rd = t[d - 1] - 1
  rq = yumiri(ZL[rd], d)
  ans += SUMD[ZL[rd][rq] - ZL[rd][rq - 1] - 1] * c[rd]
  ans += SUMD[ZL[rd][rq + 1] - ZL[rd][rq] - 1] * c[rd]
  ans -= SUMD[ZL[rd][rq + 1] - ZL[rd][rq - 1] - 1] * c[rd] 
  ZL[rd].remove(d)
  
  nd = q - 1
  nq = yumiri(ZL[nd], d)
  ans += SUMD[ZL[nd][nq + 1] - ZL[nd][nq] - 1] * c[nd]
  ans -= SUMD[d - ZL[nd][nq] - 1] * c[nd]
  ans -= SUMD[ZL[nd][nq + 1] - d - 1] * c[nd]
  ZL[nd].insert(nq + 1, d)

  ans -= s[d - 1][rd]
  ans += s[d - 1][nd]

  t[d - 1] = q

  return ans

def rieshon(t):
  ans = 0
  for i in range(D):
    ans += s[i][t[i] - 1]
    for j in range(26):
      if t[i] - 1 == j:
        L[j] = 0
        ZL[j].append(i + 1)
      else:
        L[j] += 1
        ans -= L[j] * c[j]
  for i in range(26):
    ZL[i].append(D + 1)
  return ans

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

L = [0] * 26
ZL = [[0] for _ in range(26)]
SUMD = [0] * (D + 1)
for i in range(1, D + 1):
  SUMD[i] = SUMD[i - 1] + i

t = [0] * D
for i in range(D):
  ma = s[i][0]
  man = 0
  for j in range(1, 26):
    if s[i][j] == ma:
      if c[j] < c[man]:
        ma = s[i][j]
        man = j
    elif s[i][j] > ma:
      ma = s[i][j]
      man = j
  t[i] = man + 1

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

Solution (Python):
def main():
    D = int(input())
    C = [0] * 26
    C = list(map(int,input().split()))
    S = [ list(map(int,input().split(" "))) for i in range(D)]
    
    last = [0] * 26
    for i in range(D):
        max = -9999999999999
        max_t = 0
        for t in range(26):
            score = 0
            for j in range(26):
                if j == t:
                    
                    score += S[i][j]
                else:
                    
                    score -= (last[j]+1)*C[j]
            if  score > max:
                max = score
                max_t = t
        for j in range(26):
            if j == max_t:
                last[j] = 0
            else:
                last[j] += 1
        print(max_t + 1)
if __name__ == '__main__':
    main()

Solution (Python):
d = int(input())
clst = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
last = [0 for _ in range(26)]

def score_minus(d, q):
    minus = 0
    for i, (c, ls) in enumerate(zip(clst, last)):
        if i == d:
            continue
        minus += c * (d - ls)
    return minus
    
ans = 0
for i in range(1, d + 1):
    tmp = -10 ** 10
    for q in range(26):
        tmp_score = s[i - 1][q] - score_minus(i, q)
        if tmp_score > tmp:
            tmp = tmp_score
            max_q = q
    print(max_q + 1)
    last[max_q] = i

Solution (Python):
from collections import deque

(d,), cc, *ss = [list(map(int, s.split())) for s in open(0)]

ss = deque(ss)

acc = [0]*len(cc)

while d:
    acc = [sum(x) for x in zip(acc, cc)]
    gain = [sum(x) for x in zip(acc, ss.popleft())]
    m = min(gain)
    for i, g in enumerate(gain):
        if m == g:
            cur = i
            break
    print(cur+1)
    acc[cur] = 0
    d -= 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=False))
for i in range(D):
    print(arr[i % 26]+1)

Solution (Python):
D=int(input())
C=list(map(int,input().split()))
import sys
S=sys.stdin.readlines()
A=[0]*26
B=[0]*D
k=0
for i in range(26):
  if C[i]!=0:
    k+=C[i]
for i in range(26):
  if i<25:
    A[i]=int(C[i]/k*D)
  else:
    A[i]=D-sum(A[:25])

for i in range(25):
  for j in range(A[i]):
    B[D//A[i]*j]=i+1

for i in range(D):
  if B[i]==0:
    B[i]=26


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

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)
  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,c):
      sc-=i*j
  if sc>sco:
    solution=sol
    sco=sc
for i in solution:
  print(i+1)

Solution (Python):
def main():
    D = int(input())
    c = list(map(int,input().split()))
    s = []
    for d in range(D):
        s.append(list(map(int,input().split())))
    
    last = [0 for i in range(26)]
    
    for d in range(D):
        tmp_score = [0 for i in range(26)]
        for I in range(26):
            tmp_last = last
            v = s[d][I]
            tmp_last[I] = d+1
            for i in range(26):
                v -= c[i]*(d+1-tmp_last[i])
            tmp_score[I] = v
        ans_i = tmp_score.index(max(tmp_score))
        print(ans_i+1)
        tmp_last[ans_i] = d+1
    
if __name__ == '__main__':
    main()

Solution (Python):
ans = [1]*365
for i in range(365):
    ans[i]=i%26 + 1
for i in range(365):
    print(ans[i])

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]
      
  print(max_index+1)
  index_set.remove(max_index)
  if not index_set:
    index_set=set(range(26))

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





O = [[0]*26 for _ in range(D)]
A = [[0]*26 for _ in range(D)]

def last(d,t):
    for i in range(d,-1,-1):
        if O[i][t] > 0: return i
    return 0

score = 0
t = 0
for d in range(D):
    O[d][t] = 1
    dw = 0
    for i in range(26):
        dw += C[t]*(d - last(d,i))
    A[d][t] = S[d][t] - dw
    score += A[d][t]
    print(t+1)
    t = (t+1) % 26

Solution (Python):
import random

import numpy as np

global NN
NN = 26


class Contest:
    """
    d: ある日付
    i: テストの種類
    self.day: 最後にテストiを開催した日
    """

    def __init__(self, c, s, D):
        self.test = [i % NN for i in range(D)]
        self.last = [0 for _ in range(NN)]
        self.C = c
        self.S = s
        self.score = 0

    def minus_score(self, d, i):
        m = self.C[i] * (d - self.last[i])
        return m

    def sum_minus_scores(self, d):
        m = 0
        for i in range(NN):
            m += self.minus_score(d, i)

        return m

    
    def update_score(self, i, d):
        s = self.score
        self.last[i] = d
        s += S[d][i]
        s -= self.sum_minus_scores(d)
        return s

    
    def calc_score(self, i, d):
        s = self.score
        last_d = self.last[i]
        self.last = d
        s += S[d][i]
        s -= self.sum_minus_scores(d)
        self.last = last_d

        return s


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

T = Contest(C, S, D)


tests = []
for s in S:
    ss = np.array(s)
    tests.append(np.argmax(ss))


ans = [i + 1 for i in tests]
print(*ans)


"""
+ 方針
  + Cの大きいテストは定期的に開催する
  + Cの小さいテストはまれに開催する
    + d = 1, 2, 3, 4, 5 ....
    + d-last[d] = 1, 3, 6, 10, 15 ...
    + 結構緩やか？

+ スコアを伸ばす方法
  + プラスを大きくする
  + マイナスを小さくする

"""