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(satisfaction, data, cache, new_cache, changed1, changed2):
	for k in (changed1, changed2):
		c = c_list[k]
		s, penalties = cache[k]
		satisfaction -= s - penalties * c
		
		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
		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(satisfaction, 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.8)
	print(T, value / count, math.log(math.e), math.log(0.5), file = sys.stderr)
	
	t_end = t_start + 1.8
	d = 0.999
	best = satisfaction
	best_data = list(data)
	tmp_cache = list(cache)
	
	T = 1
	c = 0
	while True:
		if time.perf_counter() > t_end:
			print("count:", c, file = sys.stderr)
			return best, best_data
		i = random.randrange(D)
		org_i = tmp_data[i]
		if random.random() < 0.1:
			j = i
			org_j = random.randrange(N)
			while org_j == org_i:
				org_j = random.randrange(N)
			tmp_data[i] = org_j
		else:
			j = random.randrange(D)
			while j == i or data[j] == org_i:
				j = random.randrange(D)
			org_j = tmp_data[j]
			tmp_data[i] = org_j
			tmp_data[j] = org_i
		
		tmp_s = calc_update(satisfaction, tmp_data, cache, tmp_cache, org_i, org_j)
#		if tmp_s != calc(tmp_data):
#			raise "hoge"
#		if tmp_s < satisfaction:
#			print(best, T, satisfaction, satisfaction - tmp_s, math.pow(math.e, -(satisfaction - tmp_s) / T), file = sys.stderr)
#		if tmp_s < satisfaction:
#			print(best, T, best, best - tmp_s, math.pow(math.e, -(best - tmp_s) / T), file = sys.stderr)
		if p(satisfaction, tmp_s, T):
#			print("y", file = sys.stderr)
			satisfaction = tmp_s
			data[j] = org_i
			data[i] = org_j
			cache[org_i] = tmp_cache[org_i]
			cache[org_j] = tmp_cache[org_j]
			if satisfaction > best:
				best = satisfaction
				best_data = list(data)
		else:
#			print("x", file = sys.stderr)
			tmp_data[j] = org_j
			tmp_data[i] = org_i
			tmp_cache[org_j] = cache[org_j]
			tmp_cache[org_i] = cache[org_i]
#		if tmp_cache != cache:
#			print(tmp_cache[org_j], cache[org_j], file = sys.stderr)
#			print(tmp_cache[org_i], cache[org_i], file = sys.stderr)
#			print(c, i, j, org_j, org_i, file = sys.stderr)
#			for i, (a, b) in enumerate(zip(cache, tmp_cache)):
#				if a != b:
#					print(i, a, b, file = sys.stderr)
#			raise "hoge2"
#		if tmp_data != data:
#			raise "hoge3"
		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: 91068