#pragma GCC optimize ("O3")
//#pragma GCC target ("tune=native")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}

//typedef array<int, 400> AR4;
struct chtime{
	chrono::system_clock::time_point stm;
	auto nget() { return chrono::system_clock::now();}
	chtime() { stm = nget();}
	uint64_t gtm(){
		return chrono::duration_cast<chrono::milliseconds>(nget()-stm).count();
	}
	void disp(){ cerr << gtm() <<"\n";}
};
chtime tmq;

ll CTM;
const ll TLMT = 2 *1000 - 50;
const int TSN = 1073741823;
mt19937 mran(20200701);//((unsigned)time(nullptr));
int D;
array<int, 26> C;
array<array<int, 26>, 400> S;
vector<bitset<400>> br(27), bl(27);
inline int xran(int su){ return mran() % su;}
inline int xran2(int su){ return mran() & su ;} //su = (2^n)-1
inline ll xran9(ll su){ return mran() & su ;}


inline ll clpt(const VI& t){
	VI usd(27, 0);
	//VL rtn(D);
	ll ans = 0;
	rep(i, D){
		ans += S[i][t[i]];
		usd[t[i]] = i+1;
		rep(j, 26){
			ans -= (ll)C[j] * (i+1 - usd[j]);
		}
		//dbg(i, ans);
	}
	return ans;
}

inline ll dpt3(const VI& t, int dy, int rt){
	ll ans = 0;
	ans +=S[dy][rt];
	int q1=dy, q2=dy;
	for(q1=dy; q1>=0 && t[q1] !=rt; q1--);
	for(q2=dy; q2 <D && t[q2] !=rt; q2++);
	ans += 1LL * C[rt] * (dy-q1) * (q2-dy);
	return ans;
}


inline ll dpt2(const VI& t, int dy, int cl){
	ll ans = 0;
	ans +=S[dy][cl];
	int q1 =0, q2 =0;
	q2 = br[cl]._Find_next(dy);
	q1 = D -1 - bl[cl]._Find_next(D-1-dy);
	ans += 1LL * C[cl] * (dy-q1) * (q2-dy);
	return ans;
}


int main()
{
	typedef pair<ll, VI> LVI;
	cin.tie(0); ios_base::sync_with_stdio(false);
	
	
	cin >>D;
	
	rep(i, 26) cin >> C[i];
	rep(i, D) rep(j, 26) cin >>S[i][j];
	int tct =0, chcnt =0, upcnt =0, tct1=0;
	rep(i, 33) xran2(1023);
	
	
	VI idt(D);
	rep(i, D) idt[i] = i%26;
	auto mypt = clpt(idt);
	dbg("Init",mypt);
	LVI BST = LVI(mypt, idt);
	

	rep(i, D){
		br[idt[i]][i] = 1;
		bl[idt[i]][D-1-i] = 1;
	}
	rep(i, 27) rep2(j, D, D+5) br[i][j] = bl[i][j] = 1;
	
	auto ALBST = BST;
	
	for(; (tct &8191) != 1000 || (CTM = tmq.gtm()) < TLMT; tct++){
		
		int d1, d2, p1, p2, op1;
		ll df = 0;
		bool shub = xran2(15) > 10;
		if(shub){
			tct1++;
			d1 = xran(D); p2 = (idt[d1] + xran(25)) %26;
			while(idt[d1]==p2) p2 = xran(26);
			op1 = idt[d1];
			df -= dpt2(idt, d1, op1); 
			idt[d1] = p2;
			br[op1][d1] = bl[op1][D-1-d1]= 0;
			br[p2][d1] = bl[p2][D-1-d1]= 1;
			df += dpt2(idt, d1, p2);
		} else {
			d1 = xran(D); d2 = xran(D);
			while(d1 == d2 || idt[d1] == idt[d2]) d2 = xran(D);
			p1 = idt[d1]; p2 = idt[d2];
			df -= dpt2(idt, d1, p1) + dpt2(idt, d2, p2);
			swap(idt[d1] , idt[d2]);
			br[p1][d1] = br[p2][d2] =0 ;
			br[p1][d2] = br[p2][d1] =1;
			bl[p1][D-1-d1] = bl[p2][D-1-d2] =0;
			bl[p2][D-1-d1] = bl[p1][D-1-d2] =1;
			df += dpt2(idt, d1, p2) + dpt2(idt, d2, p1);
		}
		
		double start_tmp=3000, end_tmp=30;
		double temp = start_tmp + (end_tmp - start_tmp) * CTM / TLMT;
		
		if(df >= 0){
			mypt += df;
			BST = LVI(mypt, idt); upcnt++;
		}else{
			double start_tmp= 2000, end_tmp = 20;
			double temp = start_tmp + (end_tmp - start_tmp) * CTM / TLMT;
			double prob = exp(df/temp);
			if(prob > xran2(TSN) / (double)TSN){
				mypt += df;
				BST = LVI(mypt , idt); chcnt++;
			}else{
				if(shub){
					idt[d1] = op1;
					br[op1][d1] = bl[op1][D-1-d1]= 1;
					br[p2][d1] = bl[p2][D-1-d1]= 0;
					
				}else{
					swap(idt[d1] , idt[d2]);
					br[p1][d1] = br[p2][d2] =1 ;
					br[p1][d2] = br[p2][d1] =0;
					bl[p1][D-1-d1] = bl[p2][D-1-d2] =1;
					bl[p2][D-1-d1] = bl[p1][D-1-d2] =0;
				}
			}
		}
		ALBST =max(ALBST, BST);
		
	}
	dbg("res",ALBST.first, BST.first, tmq.gtm(), "cnt=", tct, tct1,upcnt, chcnt);
	rep(i, D) cout << ALBST.second[i] +1 <<"\n";
	dbg("recal=", clpt(ALBST.second));
	return 0;
}
// gpp mar.cpp && a < tester\sample2.in.txt


Measured memory_bytes: 4224