#pragma GCC optimize("-Ofast","-funroll-all-loops","-ffast-math","-fno-stack-protector")
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
#include <assert.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
const int MOD=1e9+7;
#define SZ 666666
int d,c[26],s[999][26],g[999],g_[999];
int f()
{
	int lp[26];
	memset(lp,0,sizeof lp);
	int ans=0;
	for(int i=1;i<=d;++i)
	{
		assert(g[i]>=0&&g[i]<26);
		int u=i-lp[g[i]];
		ans+=s[i][g[i]]-c[g[i]]*u*(u-1)/2;
		lp[g[i]]=i;
	}
	for(int j=0;j<26;++j)
	{
		int u=d+1-lp[j];
		ans-=c[j]*u*(u-1)/2;
	}
	return ans;
}
int main()
{
	srand(time(0));//19260817);
	cin>>d;
	for(int i=0;i<26;++i) cin>>c[i];
	for(int i=1;i<=d;++i)
		for(int j=0;j<26;++j) cin>>s[i][j];
	{
	pii mx(-2e9,0);
	for(int off=0;off<26;++off)
	{
	for(int i=1;i<=d;++i) g[i]=(i+off)%26;
	mx=max(mx,pii(f(),off));
	}
	for(int i=1;i<=d;++i) g[i]=(i+mx.se)%26;
	}
	ll of=f();
	int gc=0;
	while((++gc)%100!=0||clock()<CLOCKS_PER_SEC*1.9)
	{
		for(int i=1;i<=d;++i) g_[i]=g[i];
		int x=1;
//		if(rand()%2) x=rand()%(4*(rand()%3+1))+1;
		while(rand()%4==0) ++x;
		const int up=4;
		int cc=0;
		while(!cc)
		{
			cc=0;
			if(rand()%2==0) cc|=1<<0;
			if(rand()%2==0) cc|=1<<1;
			if(rand()%2==0) cc|=1<<2;
			if(rand()%2==0) cc|=1<<3;
		}
		int LL=2e9,RR=-2e9;
		while(x--)
		{
			int p=rand()%d+1,u=up;
			while(!(cc&(1<<u))) u=rand()%up;
			if(u==0)
			{
				static pii ss[26];
				for(int x=0;x<26;++x)
					ss[x]=pii(-s[p][x],x);
				sort(ss,ss+26);
				int c=0;
				while(rand()%4) ++c;
				g[p]=ss[c%26].se;
				LL=min(LL,p);
				RR=max(RR,p);
			}
			else if(u==1)
			{
				pii mx(-1,0);
				for(int x=0;x<26;++x)
					mx=max(mx,pii(s[p][x],x));
				g[p]=mx.se;
				LL=min(LL,p);
				RR=max(RR,p);
			}
			else if(u==2)
			{
				int s=1;
				if(rand()%4) s=rand()%5+1;
				while(rand()&1) ++s;
				while(p+s>d) p=rand()%d+1;
				for(int i=p;i<p+s;++i)
					swap(g[i],g[i+1]);
				LL=min(LL,p);
				RR=max(RR,p+s);
			}
			else if(u==3)
			{
				int s=1;
				if(rand()%4) s=rand()%3+1;
				while(rand()&1) ++s;
				while(p+s>d) p=rand()%d+1;
				swap(g[p],g[p+s]);
				LL=min(LL,p);
				RR=max(RR,p+s);
			}
		}
		int rg=10;
		while(rand()&1) rg*=2;
		LL=max(LL-rg,1);
		RR=min(RR+rg,d);
		//cerr<<LL<<","<<RR<<"\n";
		if(LL<=RR)
		{
		{
			static int R[900][26],L[26];
			memset(L,0,sizeof L);
			for(int i=0;i<26;++i) R[RR+1][i]=d+1;
			for(int i=d;i>=LL;--i)
			{
				if(i<=RR)
					memcpy(R[i],R[i+1],sizeof R[i]);
				R[min(i,RR+1)][g[i]]=i;
			}
			for(int p=1;p<=RR;++p)
			{
				if(p>=LL)
				{
				pii mx(-2e9,0);
				for(int x=0;x<26;++x)
				{
					int dt=c[x]*(p-L[x])*(R[p+1][x]-p)+s[p][x];
					if(dt>mx.fi) mx.fi=dt,mx.se=x;
				}
				g[p]=mx.se;
				}
				L[g[p]]=p;
			}
		}
		{
			static int L[900][26],R[26];
			for(int i=0;i<26;++i) R[i]=d+1;
			memset(L[LL-1],0,sizeof L[LL-1]);
			for(int i=1;i<=RR;++i)
			{
				if(i>=LL)
					memcpy(L[i],L[i-1],sizeof L[i]);
				L[max(i,LL-1)][g[i]]=i;
			}
			for(int p=d;p>=LL;--p)
			{
				if(p<=RR)
				{
				pii mx(-2e9,0);
				for(int x=0;x<26;++x)
				{
					int dt=c[x]*(p-L[p-1][x])*(R[x]-p)+s[p][x];
					if(dt>mx.fi) mx.fi=dt,mx.se=x;
				}
				g[p]=mx.se;
				}
				R[g[p]]=p;
			}
		}
		}
		ll cf=f();
		if(cf<of)
		{
			for(int i=1;i<=d;++i) g[i]=g_[i];
		}
		else
		{
			#ifdef LOCAL
			if(of!=cf)
				cerr<<cf<<"\n";
			#endif
			of=cf;
		}
	}
	for(int i=1;i<=d;++i)
		cout<<g[i]+1<<"\n";
	cerr<<of<<"\n";
	cerr<<clock()<<"ms  "<<gc<<"runs\n";
}


Measured memory_bytes: 3776