#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
#include <ctime>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()



unsigned int xor128() {
	static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned int t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

double uniform() {
	return (double)xor128() / ~0u;
}




int D;
int c[26];
int s[365][26];



vector<int> greedy() {
	vector<int> ret;
	int last[26] = {};
	rep(i, 26)last[i] = -1;

	rep(i, D) {
		int ma = -INF;
		int con = -1;

		int pena[26];
		rep(j, 26) {
			pena[j] = c[j] * (i - last[j]);
		}

		rep(j,26) {
			//int score = s[i][j] + pena[j];
			int score = s[i][j] + 5 * pena[j];
			if (ma < score) {
				ma = score;
				con = j;
			}
		}
		assert(con != -1);

		last[con] = i;
		ret.push_back(con);
	}
	return ret;
}


int64_t calc(const vector<int> &ans) {
	int last[26];
	rep(i, 26)last[i] = -1;
	int64_t score = 0;
	rep(i, D) {
		score += s[i][ans[i]];
		last[ans[i]] = i;
		rep(j, 26) {
			score -= c[j] * (i - last[j]);
		}
	}
	return score;
}

int64_t penalty(int contest, int day1, int day2) {
	int64_t dur = day2 - day1 - 1;
	return c[contest] * dur * (dur + 1) / 2;
}


uint16_t poplow[1 << 16];
uint16_t pophigh[1 << 16];

int prev(uint16_t contests[23], uint32_t day) {
	uint16_t b = contests[day / 16] & ((1 << day % 16) - 1);
	if (b != 0){
		return day - (day % 16) + pophigh[b];
	}
	for (int i = day / 16 - 1; i >= 0; i--) {
		if (contests[i] != 0) {
			return i * 16 + pophigh[contests[i]];
		}
	}

	return -1;
}

int next(uint16_t contests[23], uint32_t day) {
	uint16_t b = contests[day / 16] & ~((1 << day % 16) - 1) & ~(1 << day % 16);
	if (b != 0) {
		return day - (day % 16) + poplow[b];
	}
	for (int i = day / 16 + 1; i < 23; i++) {
		if (contests[i] != 0) {
			return i * 16 + poplow[contests[i]];
		}
	}
	return D;
}

void bit_on(uint16_t contests[23], uint32_t day) {
	contests[day / 16] |= 1 << day % 16;
}

void bit_off(uint16_t contests[23], uint32_t day) {
	contests[day / 16] &= ~(1 << day % 16);
}

vector<int> annealing() {
	uint16_t contests[26][23 /*ceil(365/16)*/];

	vector<int> best;
	int64_t best_score;

	int64_t score;
	vector<int> con;
	//init by greedy
	{
		memset(contests, 0, sizeof(contests));
		vector<int> v = greedy();
		int last[26];
		memset(last, -1, sizeof(last));
		rep(i, D) {
			bit_on(contests[v[i]], i);
		}
		best = con = v;
		best_score = score = calc(v);
	}

	clock_t start = clock();
	double temp = 1;
	int max_iterates = 100000000;
	rep(ite, max_iterates) {
		if (ite % 65536 == 0) {
			clock_t now = clock();
			if ((double)(now - start) / CLOCKS_PER_SEC > 1.9)break;
			temp = max(1e-5, 2.0 - (double)(now - start) / CLOCKS_PER_SEC - 0.2);
		}

		if (xor128() % 100 < 30)  { // swap
			uint32_t day1 = xor128() % D;
			int dd = xor128() % 15 - 7;
			if (D <= day1 + dd || (int)day1 + dd < 0)continue;
			uint32_t day2 = day1 + dd;
			int con1 = con[day1];
			int con2 = con[day2];
			if (con1 == con2)continue;

			bit_off(contests[con1], day1);
			bit_off(contests[con2], day2);

			int64_t score_diff = s[day1][con2] + s[day2][con1] - s[day1][con1] - s[day2][con2]
				- penalty(con2, prev(contests[con2], day1), day1)
				- penalty(con2, day1, next(contests[con2], day1))
				- penalty(con1, prev(contests[con1], day2), day2)
				- penalty(con1, day2, next(contests[con1], day2))
				+ penalty(con1, prev(contests[con1], day1), day1)
				+ penalty(con1, day1, next(contests[con1], day1))
				+ penalty(con2, prev(contests[con2], day2), day2)
				+ penalty(con2, day2, next(contests[con2], day2))
				- penalty(con1, prev(contests[con1], day1), next(contests[con1], day1))
				- penalty(con2, prev(contests[con2], day2), next(contests[con2], day2))
				+ penalty(con1, prev(contests[con1], day2), next(contests[con1], day2))
				+ penalty(con2, prev(contests[con2], day1), next(contests[con2], day1));

			//if (score_diff > 0 || -score_diff / temp / 1000 < uniform()) {
			if (score_diff > 0 || exp(score_diff / temp / 700) > uniform()) {
				bit_on(contests[con1], day2);
				bit_on(contests[con2], day1);
				score += score_diff;
				swap(con[day1], con[day2]);
				if (best_score < score) {
					best = con;
					best_score = score;
				}
			}
			else {
				bit_on(contests[con1], day1);
				bit_on(contests[con2], day2);
			}
		}
		else { // change
			uint32_t day = xor128() % D;
			int to = xor128() % 26;
			if (con[day] == to)continue;

			int c1prev = prev(contests[con[day]], day);
			int c1next = next(contests[con[day]], day);
			int c2prev = prev(contests[to], day);
			int c2next = next(contests[to], day);

			int64_t score_diff = s[day][to] - s[day][con[day]]
				- penalty(con[day], c1prev, c1next)
				- penalty(to, c2prev, day) - penalty(to, day, c2next)
				+ penalty(con[day], c1prev, day) + penalty(con[day], day, c1next)
				+ penalty(to, c2prev, c2next);

			//if (score_diff > 0 || -score_diff / temp / 2500 < uniform()) {
			if (score_diff > 0 || exp(score_diff / temp / 700) > uniform()){
				score += score_diff;
				bit_off(contests[con[day]], day);
				bit_on(contests[to], day);
				con[day] = to;
				if (best_score < score) {
					best = con;
					best_score = score;
				}
			}
		}
	}
	cerr << best_score << endl;
	cerr << calc(best) << endl;
	return best;
}




int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	for (int i = 1; i < (1 << 16); i++) {
		int low, high;
		rep(j, 16) {
			if (i>>j&1) {
				low = j;
				break;
			}
		}
		rep(j, 16) {
			if (i >> j & 1) {
				high = j;
			}
		}
		poplow[i] = low;
		pophigh[i] = high;
	}


#if defined(_MSC_VER)
	D = 365;
	mt19937 mt;
	rep(i, 26)c[i] = mt() % 100;
	rep(i, 365)rep(j, 26) s[i][j] = mt() % 20000;
#else
	cin >> D;
	rep(i, 26)cin >> c[i];
	rep(i, 365)rep(j, 26)cin >> s[i][j];
#endif // #if defined(_MSC_VER)


	vector<int> ans = annealing();
	for (int x: ans) {
		cout << x + 1 << endl;
	}


	return 0;
}


Measured memory_bytes: 4556