#pragma GCC optimize("Ofast")

#include <vector>
#include <iostream>
#include <utility>
#include <cmath>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <utility>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int,int> pii;
// #define int ll
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; ++i) 
#define REP(i,n) for(int i = 0;i < (n) ; ++i) 
#define MP(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
inline unsigned long long xor128() {
	static unsigned long long rx = 123456789, ry = 986960440, rz = 738905609, rw = 23140692;
	unsigned long long rt = (rx ^ (rx << 11));
	rx = ry;ry = rz;rz = rw;
	return (rw = (rw ^ (rw >> 19)) ^ (rt ^ (rt >> 8)));
}
inline double rand128(double min = 0, double max = 1){
	return (double)(xor128() % 0xFFFF) / 0xFFFF * (max - min) + min;
}

inline uint64_t rdtsc(){
	uint32_t hi,lo;
	__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
	return ((uint64_t)lo) | (((uint64_t)hi)<<32);
}
inline double GetSeconds() {
	// return rdtsc()/2.8e9; //Topcoder
	return rdtsc()/3.0e9; // Atcoder
}
double start_time;
const double TL = 1.98;
const double TL2 = 0.65;
/*----------------------------------------------------------------*/

const int D = 365;
int c[26] = {};
int s[365][26] = {};

int best_t[365] = {};

int t[365] = {};
// int last_d[26] = {};
int best_score,score;

/*----------------------------------------------------------------*/

void input(){
	int xxx;cin >> xxx;
	rep(i,26)cin >> c[i];
	rep(i,D)rep(j,26) cin >> s[i][j];
}
void output(){
	rep(i,D)cout << best_t[i]+1 << '\n';
}

int calc_all(){
	int res = 0;
	int last[26] = {};
	for(int d = 1;d <= D;d++){
		res += s[d-1][t[d-1]];
		last[t[d-1]] = d; 
		rep(i,26){
			res -= c[i]*(d - last[i]);
		}
	}
	return res;
}

void greedy(){
	int last[26] = {};
	for(int d = 1;d <= D;d++){
		int max_contest = 0;
		int max_diff = -1000000;
		rep(j,26){
			int diff = s[d-1][j] + c[j]*(d - last[j]);
			if(max_diff < diff){
				max_diff = diff;
				max_contest = j;
			}
		}
		last[max_contest] = d;
		t[d-1] = best_t[d-1] = max_contest;
	}
}

int cnt = 0;
set<int> contest_day[26];
int contest_score[26] = {};
int calc_contest_loss(int id){
	int pre = 0;
	int res = 0;
	for(auto x:contest_day[id]){
		int n = x - pre;
		res += n*(n-1)/2;
		pre = x;
	}
	return -c[id]*res;
}

// int calc_change_diff(int d,int c1, int c2){
// 	int diff = s[d][c2] - s[d][c1];
// 	set<int> cd1 = contest_day[c1];
// 	set<int> cd2 = contest_day[c2];
// 	// ここコピー or 使い回し
// 	cd1.erase(d+1);
// 	cd2.insert(d+1);
// 	diff += - contest_score[c1] - contest_score[c2]
// 			+ calc_contest_loss(cd1,c1) + calc_contest_loss(cd2,c2);
// 	return diff;
// }

// int calc_test(){
// 	int test_sum = 0;
// 	rep(i,26)test_sum += contest_score[i];
// 	rep(i,365)test_sum += s[i][t[i]];
// 	return test_sum;
// }

// int cnt_swap[100] = {};
// vector<int> swap_cnt;
// vector<int> change_cnt;


void sa(){

	best_score = score = calc_all();
	rep(i,26){
		contest_day[i].insert(0);
		contest_day[i].insert(D+1);
	}
	rep(i,365)contest_day[t[i]].insert(i+1);
	// rep(i,365)contest_score[t[i]] += s[i][t[i]];
	rep(i,26)contest_score[i] = calc_contest_loss(i);

	// int test_sum = 0;
	// rep(i,26)test_sum += contest_score[i];
	// rep(i,365)test_sum += s[i][t[i]];
	// cerr << "pre score = " << score << endl;
	// cerr << "pre score (use set) = " << test_sum << endl;


	double saTimeStart    = GetSeconds() - start_time; 
  	double saTimeEnd      = TL;// Time Limit (ms)
	double Time = saTimeEnd-saTimeStart;// SAに使う時間
	double elapsed = GetSeconds() - start_time;

	while(1){
		elapsed = GetSeconds() - start_time;
		if(elapsed > TL)break;
		double time = elapsed-saTimeStart; 
		cnt++;

		if(xor128()%100 <= 20){
			int d = xor128()%D;
			int c1 = t[d];
			int c2 = xor128()%26;
			if(c1 == c2)continue;

			int diff = s[d][c2] - s[d][c1];
			contest_day[c1].erase(d+1);
			contest_day[c2].insert(d+1);
			int loss_c1 = calc_contest_loss(c1);
			int loss_c2 = calc_contest_loss(c2);
			diff += - contest_score[c1] - contest_score[c2];
			diff += loss_c1 + loss_c2;

			int next_score = score + diff;

			if(next_score > best_score){
				rep(i,D)best_t[i] = t[i];
				best_t[d] = c2;
				best_score = next_score; 
			}

			double deadline = 8100;
			double p = rand128(0,1)*deadline*Time;
			double seni = (Time-time)*(diff+deadline);

			if(diff >= 0 || seni > p){
				score = next_score;
				contest_score[c1] = loss_c1;
				contest_score[c2] = loss_c2;
				t[d] = c2;
				// if(diff > 0)change_cnt.push_back(cnt);
			}else{	
				contest_day[c1].insert(d+1);
				contest_day[c2].erase(d+1);
			}
		}else{
			// swap
			int d1 = xor128()%(D-1);
			int d2 = d1 + 1 + xor128()%min(13,D-d1-1);
			int c1 = t[d1];
			int c2 = t[d2];
			if(c1 == c2)continue;

			int diff = -s[d1][c1] - s[d2][c2] + s[d2][c1] + s[d1][c2];
			contest_day[c1].erase(d1+1);
			contest_day[c1].insert(d2+1);
			contest_day[c2].erase(d2+1);
			contest_day[c2].insert(d1+1);
			int loss_c1 = calc_contest_loss(c1);
			int loss_c2 = calc_contest_loss(c2);
			diff += - contest_score[c1] - contest_score[c2];
			diff += loss_c1 + loss_c2;
			int next_score = score + diff;

			if(next_score > best_score){
				rep(i,D)best_t[i] = t[i];
				best_t[d1] = c2;
				best_t[d2] = c1;
				best_score = next_score; 
			}

			double deadline = 3600;
			double p = rand128(0,1)*deadline*Time;
			double seni = (Time-time)*(diff+deadline);

			if(diff >= 0 || seni > p){
				score = next_score;
				contest_score[c1] = loss_c1;
				contest_score[c2] = loss_c2;
				t[d1] = c2;
				t[d2] = c1;

				// if(diff > 0){
				// 	cnt_swap[d2-d1]++;
				// }
				// if(diff > 0)swap_cnt.push_back(cnt);
			}else{	
				contest_day[c2].erase(d1+1);
				contest_day[c2].insert(d2+1);
				contest_day[c1].erase(d2+1);
				contest_day[c1].insert(d1+1);
			}
		}

	}
}

/*----------------------------------------------------------------*/
signed main(){
	start_time = GetSeconds();

	input();
	greedy();
	sa();
	output();

	cerr << "cnt : " << cnt << endl;
	cerr << "best score : " << best_score << endl;

	// cerr << "swap" << endl;
	// rep(i,30)cerr << i << " : " << cnt_swap[i] << endl;

	// for(auto x:swap_cnt)cout << x << endl;
	// for(auto x:change_cnt)cerr << x << endl;

	return 0;
}

/*----------------------------------------------------------------*/


Measured memory_bytes: 3744