//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include<cstdio>
#include<ctime>
#include<cstdlib>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }
template <class T, class... A>
void printd(const T &first, const A &... rest) { cout << fixed << setprecision(15) << first; prints_rest(rest...); }


namespace {
	// printElems(&a[0], &a[n]);　みたいな感じで使う。
	void printElems(const int* begin, const int* end)
	{
		for (const int* p = begin; p != end; ++p) {
			std::cout << *p << ' ';
		}
		std::cout << std::endl;
	}
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const ll BIG = 1LL<<60;

//--------------------------------------------------------





int c[30];
int s[400][30];
pii done[400][30];
int donepro[400];
int lastdone[30];



int main(){
	//chrono::system_clock::time_point start, end;
	//start = chrono::system_clock::now();
	rep(j,366)rep(i,26) done[j][i].S = 365;

	//double jikan;


	int d;
	cin >> d;
	rep(i,26) cin >> c[i];
	rep1(i,d)rep(j,26) cin >> s[i][j];
	srand(time(NULL));

	rep1(dtmp,d){
		int tmp = 0;
		rep(i,26) tmp += (lastdone[i] - dtmp) * c[i]+(lastdone[i] - (dtmp+1)) * c[i];
		int maxtmp = _inf;
		int docon = 0;
		rep(i,26){
			rep(j,26){
				rep(k,26){
					if(i == j && j == k){
						if(maxtmp <= tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i] + c[j] +s[dtmp+1][j] + c[k] +s[dtmp+2][k]){
							maxtmp = tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i]+ c[j] +s[dtmp+1][j] + c[k] +s[dtmp+2][k];
							docon = i;
						}
					}
					elif(i == j){
						if(maxtmp <= tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i] + c[j] +s[dtmp+1][j] + (dtmp+2-lastdone[k])*c[k] +s[dtmp+2][k]){
							maxtmp = tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i]+ c[j] +s[dtmp+1][j] + (dtmp+2-lastdone[k])*c[k] +s[dtmp+2][k];
							docon = i;
						}
					}
					elif(i == k){
						if(maxtmp <= tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i] + (dtmp+1-lastdone[j])*c[j] +s[dtmp+1][j] + 2*c[k] +s[dtmp+2][k]){
							maxtmp = tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i]+ (dtmp+1-lastdone[j])*c[j] +s[dtmp+1][j] + 2*c[k] +s[dtmp+2][k];
							docon = i;
						}
					}
					elif(j == k){
						if(maxtmp <= tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i] + (dtmp+1-lastdone[j])*c[j] +s[dtmp+1][j] + c[k] +s[dtmp+2][k]){
							maxtmp = tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i]+ (dtmp+1-lastdone[j])*c[j] +s[dtmp+1][j] + c[k] +s[dtmp+2][k];
							docon = i;
						}
					}
					elif(maxtmp <= tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i] + (dtmp+1-lastdone[j])*c[j] +s[dtmp+1][j] + (dtmp+2-lastdone[k])*c[k] +s[dtmp+2][k]){
						maxtmp = tmp + (dtmp-lastdone[i])*c[i] +s[dtmp][i]+ (dtmp+1-lastdone[j])*c[j] +s[dtmp+1][j] + (dtmp+2-lastdone[k])*c[k] +s[dtmp+2][k];
						docon = i;
					}
				}
			}


		}
		done[dtmp][docon] = mp(lastdone[docon],366);
		done[lastdone[docon]][docon].S = dtmp;
		for(int i = lastdone[docon]; i < dtmp; i++){
			done[i][docon].S = dtmp;
		}
		rep(i,26){
			if(i == docon) continue;
			done[dtmp][i].F = lastdone[i];
		}
		donepro[dtmp] = docon;
		lastdone[docon] = dtmp;

	}

    //jikan = static_cast<double>(chrono::duration_cast<chrono::microseconds>(chrono::system_clock::now() - start).count() / 1000.0);

	//ll itr = 0;
	//while(jikan < 1989){
	rep(_,33893901){
		//itr++;
		int dtmp = (rand()%d)+1;
		int defo = donepro[dtmp];
		int docon = -1;
		int defopt = (dtmp - done[dtmp][defo].F)*c[defo]*(done[dtmp][defo].S-dtmp) + s[dtmp][defo];


		rep(i,26){
			if(i == defo) continue;
			int tmp = (dtmp - done[dtmp][i].F)*c[i]*(done[dtmp][i].S-dtmp)+s[dtmp][i];
			if(defopt < tmp) docon = i;
		}
		//jikan = static_cast<double>(chrono::duration_cast<chrono::microseconds>(chrono::system_clock::now() - start).count() / 1000.0);

		if(docon == -1) continue;

		for(int i = done[dtmp][docon].F; i < dtmp; i++) done[i][docon].S = dtmp;
		for(int i = dtmp+1; i <= done[dtmp][docon].S; i++) done[i][docon].F = dtmp;
		for(int i = done[dtmp][defo].F; i < dtmp; i++) done[i][defo].S = done[dtmp][defo].S;
		for(int i = dtmp+1; i <= done[dtmp][defo].S; i++) done[i][defo].F = done[dtmp][defo].F;
		donepro[dtmp] = docon;
	}
	//prints("itr is ",itr);
    //jikan = static_cast<double>(chrono::duration_cast<chrono::microseconds>(chrono::system_clock::now() - start).count() / 1000.0);
	//prints(jikan);


	rep1(i,d) prints(donepro[i]+1);







    //jikan = static_cast<double>(chrono::duration_cast<chrono::microseconds>(chrono::system_clock::now() - start).count() / 1000.0);



	return 0;
}





Measured memory_bytes: 3308