local D=io.read"*n"

local c={}
for i=1,26 do c[i]=io.read"*n"end
local s={}
for i=1,D do s[i]={}for j=1,26 do s[i][j]=io.read"*n"end end

local function copy(t)local ret={}for i,v in ipairs(t)do ret[i]=v end return ret end

local function calc(d,t,l)
	local a=0
	l[t]=d
	for j=1,26 do
		a=a-c[j]*(d-l[j])
	end
	return a+s[d][t]
end

local t={}
for i=1,D do t[i]=io.read"*n"end

local last={}
for i=1,26 do
last[i]=0
end

local ret={}
local a=0
--score,contestid,last
local beam={{0,{},last}}
for i=1,D do
	local newbeam={}
	for k,b in ipairs(beam) do
		local lastt={}
		for j=1,26 do
			lastt[j]=copy(b[3])
		end
		for j=1,26 do
			local t=copy(b[2])
			table.insert(t,j)
			table.insert(newbeam,{b[1]+calc(i,j,lastt[j]),t,lastt[j]})
		end
	end
	table.sort(newbeam,function(a,b)return a[1]>b[1]end)
	newbeam[6]=nil
	beam=newbeam
end

for i,v in ipairs(beam[1][2])do
print(v)
end