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

s_table = list(zip(*s_table))

print(satisfaction, file = sys.stderr)

def calc(data):
	satisfaction = 0
	for k, c in enumerate(c_list):
		last = -1
		penalties = 0
		s_list = s_table[k]
		for i, j in enumerate(data):
			if j == k:
				satisfaction += s_list[i]
				last = i
			else:
				penalties += i - last
		satisfaction -= penalties * c
	return satisfaction

def calc2(data):
	satisfaction = 0
	cache = []
	for k, c in enumerate(c_list):
		last = -1
		penalties = 0
		s_list = s_table[k]
		s = 0
		for i, j in enumerate(data):
			if j == k:
				s += s_list[i]
				last = i
			else:
				penalties += i - last
		satisfaction += s - penalties * c
		cache.append((s, penalties))
	return satisfaction, cache

def calc_update(data, cache, new_cache, changed1, changed2):
	satisfaction = 0
	for k, c in enumerate(c_list):
		if k == changed1 or k == changed2:
			last = -1
			penalties = 0
			s_list = s_table[k]
			s = 0
			for i, j in enumerate(data):
				if j == k:
					s += s_list[i]
					last = i
				else:
					penalties += i - last
		else:
			s, penalties = cache[k]
		new_cache[k] = (s, penalties)
		satisfaction += s - penalties * c
	return satisfaction

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

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):
	value = 0
	count = 0
	
	satisfaction, cache = calc2(data)
	tmp_data = list(data)
	tmp_cache = list(cache)
	
	for i in range(D):
		j = random.randrange(N)
		while data[i] == j:
			j = random.randrange(N)
		org = tmp_data[i]
		tmp_data[i] = j
		tmp_s = calc_update(tmp_data, cache, tmp_cache, j, org)
		
		if tmp_s < satisfaction:
			value += tmp_s - satisfaction
			count += 1
		tmp_data[i] = org
	
	T = (value / count) / math.log(0.1)
	print(T, value / count, math.log(math.e), math.log(0.5), file = sys.stderr)
	
	t_end = t_start + 1.8
	d = 0.9999
	best = satisfaction
	best_data = list(data)
	
	c = 0
	while True:
		if time.perf_counter() > t_end:
			print("count:", c, file = sys.stderr)
			return best, best_data
		i = random.randrange(D)
		j = random.randrange(N)
		while j == data[i]:
			j = random.randrange(N)
		org = tmp_data[i]
		tmp_data[i] = j
		tmp_s = calc_update(tmp_data, cache, tmp_cache, j, org)
		if p(satisfaction, tmp_s, T):
			satisfaction = tmp_s
			data[i] = j
			cache[j] = tmp_cache[j]
			cache[org] = tmp_cache[org]
			if satisfaction > best:
				best = satisfaction
				best_data = list(data)
		else:
			tmp_data[i] = org
			tmp_cache[j] = cache[j]
			tmp_cache[org] = cache[org]
		c += 1
		T *= d

satisfaction, data = optimize(satisfaction, data)

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

for j in data:
	print(j + 1)


Measured memory_bytes: 85848