#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];
	for(int i=1;i<=d;++i) g[i]=i%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=5;
		int cc=0;
		while(!cc)
		{
			cc=0;
			if(rand()%3==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;
			if(rand()%2==0) cc|=1<<4;
		}
		while(x--)
		{
			int p=rand()%d+1,u=up;
			while(!(cc&(1<<u))) u=rand()%up;
			if(u==0) g[p]=rand()%26;
			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;
			}
			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]);
			}
			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]);
			}
			else if(u==4)
			{
				int ss=1;
				if(rand()%4) ss=rand()%10+1;
				while(rand()&1) ++ss;
				int l=max(p-ss,1),r=min(p+ss,d);
				pii op(0,p);
				for(int x=l;x<=r;++x)
				{
					int dt=
					s[x][g[p]]+s[p][g[x]]
					-s[x][g[x]]-s[p][g[p]];
					if(dt>op.fi) op.fi=dt,op.se=x;
				}
				swap(g[p],g[op.se]);
			}
		}
		{
			static int R[900][26],L[26];
			memset(L,0,sizeof L);
			for(int i=0;i<26;++i) R[d+1][i]=d+1;
			for(int i=d;i>=1;--i)
			{
				memcpy(R[i],R[i+1],sizeof R[i]);
				R[i][g[i]]=i;
			}
			for(int p=1;p<=d;++p)
			{
				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[0],0,sizeof L[0]);
			for(int i=1;i<=d;++i)
			{
				memcpy(L[i],L[i-1],sizeof L[i]);
				L[i][g[i]]=i;
			}
			for(int p=d;p>=1;--p)
			{
				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: 3716