#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, 366> 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;
mt19937 mran(20202019); //((unsigned)time(nullptr));
int D;
array<int, 26> C;
array<array<int, 26>, 366> S;
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 ;}

array<double, 101>  mkfq(int n = 100){
	array<double, 101> zzx;
	rep(i, 101)  zzx[i] = 1 -(1 - i /(100.0)) * (1 - i/(100.0));
	rep(i, 101)  zzx[i] /= 100.0;
	return zzx;
}

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 dpt2(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;
}




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];
	const auto fqd = mkfq(100);
	int tct =0, chcnt =0, upcnt =0, tct1=0;
	rep(i, 66) xran2(1023);
	
	
	VI idt(D);
	rep(i, D) idt[i] = (i+3)%26;
	auto mypt = clpt(idt);
	dbg("Init",mypt);
	LVI BST = LVI(mypt, idt);
	auto ALBST = BST;
	
	for(; (tct &8191) != 1000 || (CTM = tmq.gtm()) < TLMT; tct++){
		
		if(xran2(15) > 9){
			tct1++;
			int d1 = xran(D), p2 = (idt[d1] + xran(25)) %26;
			while(idt[d1]==p2) p2 = xran(26);
			int op1 = idt[d1];
			ll df = dpt2(idt, d1, p2); 
			idt[d1] = p2;
			df -= dpt2(idt, d1, op1);
			if(df >= 0){
				mypt += df;
				BST = LVI(mypt, idt); upcnt++;
			}else{
				double zan = 1.0 - 1.0 * CTM / TLMT; 
				int qw= zan*100;
				qw = max(0, min(99, qw));
				if(xran2(1023) < fqd[qw] * 1023  && BST.first != 0 &&
					abs((BST.first - mypt) / BST.first)  < fqd[qw]  ){
					mypt += df;
					BST = LVI(mypt , idt); chcnt++;
				}else{
					idt[d1] = op1;
				}
			}
		}else{
			int d1 = xran(D), d2 = xran(D);
			while(idt[d1] == idt[d2]) d2 = xran(D);
			int p1 = idt[d1], p2 = idt[d2];
			ll df = dpt2(idt, d1, p2) + dpt2(idt, d2, p1);
			swap(idt[d1] , idt[d2]);
			df -= dpt2(idt, d1, p1) + dpt2(idt, d2, p2);
			if(df >= 0){
				mypt += df;
				BST = LVI(mypt, idt); upcnt++;
			}else{
				double zan = 1.0 - 1.0 * CTM / TLMT; 
				int qw= zan*100;
				qw = max(0, min(99, qw));
				if(xran2(1023) < fqd[qw] * 1023  && BST.first != 0 &&
					abs((BST.first - mypt) / BST.first)  < fqd[qw]  ){
					mypt += df;
					BST = LVI(mypt , idt); chcnt++;
				}else{
					swap(idt[d1] , idt[d2]);
				}
			}
		}
		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: 3692