#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define pb push_back

using VI = vector <int>;
using ll = long long;

const ll inf = 0x3f3f3f3f3f3f3f3f;
const int MXT = 26;
const int MXD = 365;

int D;
int C[MXT+10], S[MXD+10][MXT+10];

VI best;
ll best_score;

inline unsigned long long rdtsc() {
#ifdef __amd64
    unsigned long long a, d;
    __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
    return (d << 32) | a;
#else
    unsigned long long x;
    __asm__ volatile ("rdtsc" : "=A" (x));
    return x;
#endif
}
inline double gettime(){return rdtsc()/2993344000.0;}
inline double elapsed(double st){return gettime()-st;}

namespace MyChecker {
	int last[MXT+10];
	ll calc_score(VI ans = best) {
		fill_n(last + 1, MXT, 0);
		if (ans.size() != D) {puts("Wrong Answer"); assert(0);}
		int d = 0;
		ll score = 0;
		for (auto x : ans) {
			++ d;
			score += S[d][x];
			last[x] = d;
			for (int i = 1; i <= MXT; i ++) score -= 1ll * C[i] * (d - last[i]);
		}
		return max(0ll, score + 1000000);
	}
}

void update_ans(VI &current, ll new_score = -inf) {
	if (new_score == -inf) new_score = MyChecker::calc_score(current);
	if (best.empty() || best_score < new_score) {
		best_score = new_score;
		best = current;
	}
	return;
}

void input_and_init() {
	scanf("%d", &D);
	for (int i = 1; i <= MXT; i ++) scanf("%d", &C[i]);
	for (int i = 1; i <= D; i ++) {
		for (int j = 1; j <= MXT; j ++) scanf("%d", &S[i][j]);
	}
	best.clear();
	return;
}
void output() {
	for (auto x : best) printf("%d\n", x);
}

namespace Greedy {
	int last[MXT+10];
	ll greedy(double param) {
		fill_n(last, MXT+1, 0);
		ll delta[MXT + 1] = {0};
		VI greedy_ans;
		ll score = 0;
		for (int i = 1; i <= D; i ++) {
			for (int j = 1; j <= MXT; j ++) delta[j] += C[j];
			ll sum = accumulate(delta + 1, delta + MXT + 1, 0ll);
			double mx = -2e18; int ansd = -1;
			for (int j = 1; j <= MXT; j ++) {
				double val = param * delta[j] + S[i][j];
				if (mx < val) mx = val, ansd = j;
			}
			score += S[i][ansd] + delta[ansd] - sum;
			delta[ansd] = 0; last[ansd] = i;
			greedy_ans.pb(ansd);
		}
		update_ans(greedy_ans, max(score + 1000000, 0ll));
		return score;
	}
	void greedy_solve() {
		for (double x = 1; x <= 10; x += 1) greedy(x);
	}
}
namespace Update1 {
	VI days[MXT+1];
	VI plan;
	ll score;

	VI random_days, cur, best;
	ll mx = -inf;
	void erase(int d, int type) {
		auto it = lower_bound(days[type].begin(), days[type].end(), d);
		score -= (*it - *prev(it)) * (*next(it) - *it) * C[type];
		score -= S[d][type];
		days[type].erase(it);
		plan[d-1] = 0;
	}
	void add(int d, int type) {
		auto it = lower_bound(days[type].begin(), days[type].end(), d);
		score += (d - *prev(it)) * (*it - d) * C[type];
		score += S[d][type];
		days[type].insert(it, d);
		plan[d-1] = type;
	}
	void dfs(int x) {
		if (x == random_days.size()) {
			if (mx < score) mx = score, best = cur;
			return;
		}
		for (int i = 1; i <= MXT; i ++) {
			cur[x] = i;
			add(random_days[x], i);
			dfs(x + 1);
			erase(random_days[x], i);
		}
		return;
	}

	void update1(VI &_plan) {
		int d = 0;
		plan = _plan;
		score = MyChecker::calc_score();
		for (int i = 1; i <= MXT; i ++) days[i] = {0};
		for (auto x : plan) days[x].pb(++d);
		for (int i = 1; i <= MXT; i ++) days[i].pb(D+1);


		for (int step = 0; step < 10000; step ++) {
			ll prv = score;
			random_days.clear();
			while (random_days.size() < 2) {
				int d = rng() % 365 + 1;
				random_days.pb(d);
			}

			sort(random_days.begin(), random_days.end());
			random_days.erase(unique(random_days.begin(), random_days.end()), random_days.end());

			for (auto x : random_days) erase(x, plan[x-1]);
			cur.resize(random_days.size());

			mx = -inf;
			dfs(0);
			for (int i = 0; i < random_days.size(); i ++) add(random_days[i], best[i]);
			assert(score == mx);
		}
		update_ans(plan, score);
	}
}

namespace Update2 {
	VI plan, days[MXT+1];

	ll dp[MXD+10][MXD+10];
	int prv[MXD+10][MXD + 10];
	ll update_solve(int x, int y) {
		if (days[x].empty() && days[y].empty()) return 0;
		VI dd;
		dd.pb(0);
		for (auto y : days[x]) dd.pb(y);
		for (auto x : days[y]) dd.pb(x);
		sort(dd.begin(), dd.end());

		int sz = dd.size() - 1;
		for (int i = 0; i <= sz; i ++) fill(dp[i], dp[i] + sz + 1, -1);
		dp[0][0] = 0;
		for (int i = 1; i <= sz; i ++) {
			ll tmp;
			for (int j = 0; j < i; j ++) {
				if (dp[j][i-1] >= 0) {
					tmp = dp[j][i-1] + S[dd[i]][y] + C[y] * (dd[i] - dd[i-1]) * dd[i-1];
					if (dp[j][i] < tmp) dp[j][i] = tmp, prv[j][i] = (j << 10) | (i - 1);
					tmp = dp[j][i-1] + S[dd[i]][x] + C[x] * (dd[i] - dd[j]) * dd[j];
					if (dp[i][i-1] < tmp) dp[i][i-1] = tmp, prv[i][i-1] = (j << 10) | (i - 1);
				}
				if (dp[i-1][j] >= 0) {
					tmp = dp[i-1][j] + S[dd[i]][x] + C[x] * (dd[i] - dd[i-1]) * dd[i-1];
					if (dp[i][j] < tmp) dp[i][j] = tmp, prv[i][j] = (i-1 << 10) | j;
					tmp = dp[i-1][j] + S[dd[i]][y] + C[y] * (dd[i] - dd[j]) * dd[j];
					if (dp[i-1][i] < tmp) dp[i-1][i] = tmp, prv[i-1][i] = (i-1 << 10) | j;
				}
			}
		}
		ll mx = -1;
		int ex = -1, ey = -1;
		for (int i = 0; i < sz; i ++) {
			ll tmp;
			tmp = dp[i][sz] + (D + 1 - dd[i]) * C[x] * dd[i] + (D + 1 - dd[sz]) * C[y] * dd[sz];
			if (mx < tmp) mx = tmp, ex = i, ey = sz;
			tmp = dp[sz][i] + (D + 1 - dd[sz]) * C[x] * dd[sz] + (D + 1 - dd[i]) * C[y] * dd[i];
			if (mx < tmp) mx = tmp, ex = sz, ey = i;
		}
		days[x].clear(), days[y].clear();
		if (ex) days[x].pb(dd[ex]);
		if (ey) days[y].pb(dd[ey]);
		while (ex > 0 || ey > 0) {
			int px = prv[ex][ey] >> 10, py = prv[ex][ey] & 1023;
			if (px != ex) {ex = px; if (ex) days[x].pb(dd[ex]);}
			if (py != ey) {ey = py; if (ey) days[y].pb(dd[ey]);}
		}

		reverse(days[x].begin(), days[x].end());
		reverse(days[y].begin(), days[y].end());
		return mx;
	}

	void update2(VI &_plan) {
		plan = _plan;

		for (int i = 1; i <= MXT; i ++) days[i].clear();
		int d = 0;
		for (auto x : plan) days[x].pb(++ d);

		for (int step = 0; step < 10000; step ++) {
			int x = rng() % 26 + 1, y = rng() % 26 + 1;
			if (x == y) {step --; continue;}
		}
		for (int i = 1; i <= MXT; i ++) {
			for (auto x : days[i]) plan[x-1] = i;
		}
		ll score = MyChecker::calc_score(plan);
		update_ans(plan, score);
	}
}

namespace Update3 {
	VI plan, days[MXT+1];
	ll dp[150][150][150];
	int prv[150][150][150];
	void update_solve(int x, int y, int z) {
		if (days[x].empty() || days[y].empty() || days[z].empty()) return;

		VI dd;
		dd.pb(0);
		for (auto t : days[x]) dd.pb(t);
		for (auto t : days[y]) dd.pb(t);
		for (auto t : days[z]) dd.pb(t);
		sort(dd.begin(), dd.end());

		int sz = dd.size() - 1;
		for (int i = 0; i <= sz; i ++) for (int j = 0; j <= sz; j ++) fill(dp[i][j], dp[i][j] + sz + 1, -1);
		dp[0][0][0] = 0;

		int cx = C[x], cy = C[y], cz = C[z];

		auto upd = [](int x, int y, int z, ll val, int sta) {
			if (dp[x][y][z] < val) {
				dp[x][y][z] = val;
				prv[x][y][z] = sta;
			}
		} ;

		for (int i = 0; i < sz; i ++) {
			int now = dd[i+1];
			int sx = S[now][x], sy = S[now][y], sz = S[now][z];
			int di = (now - dd[i]) * dd[i];
			for (int j = 0; j <= i; j ++) {
				int dj = (now - dd[j]) * dd[j];
				for (int k = 0; k <= i; k ++) {
					int dk = (now - dd[k]) * dd[k];
					ll &res1 = dp[i][j][k];
					if (res1 >= 0) {
						int sta = i<<20|j<<10|k;
						upd(i+1, j, k, res1 + di * cx + sx, sta);
						upd(i, i+1, k, res1 + dj * cy + sy, sta);
						upd(i, j, i+1, res1 + dk * cz + sz, sta);
					}
					ll &res2 = dp[j][i][k];
					if (res2 >= 0) {
						int sta = j<<20|i<<10|k;
						upd(j, i+1, k, res2 + di * cy + sy, sta);
						upd(i+1, i, k, res2 + dj * cx + sx, sta);
						upd(j, i, i+1, res2 + dk * cz + sz, sta);
					}
					ll &res3 = dp[j][k][i];
					if (res3 >= 0) {
						int sta = j<<20|k<<10|i;
						upd(j, k, i+1, res3 + di * cz + sz, sta);
						upd(j, i+1, i, res3 + dk * cy + sy, sta);
						upd(i+1, k, i, res3 + dj * cx + sx, sta);
					}
				}
			}
		}

		ll mx = -1;
		int ex = -1, ey = -1, ez = -1;
		for (int i = 0; i < sz; i ++)
		for (int j = 0; j < sz; j ++) {
			ll tmp;
			tmp = (D+1-dd[i])*dd[i]*cx + (D+1-dd[j])*dd[j]*cy + (D+1-dd[sz])*dd[sz]*cz + dp[i][j][sz];
			if (tmp > mx) mx = tmp, ex = i, ey = j, ez = sz;
			tmp = (D+1-dd[i])*dd[i]*cx + (D+1-dd[sz])*dd[sz]*cy + (D+1-dd[j])*dd[j]*cz + dp[i][sz][j];
			if (tmp > mx) mx = tmp, ex = i, ey = sz, ez = j;
			tmp = (D+1-dd[sz])*dd[sz]*cx + (D+1-dd[i])*dd[i]*cy + (D+1-dd[j])*dd[j]*cz + dp[sz][i][j];
			if (tmp > mx) mx = tmp, ex = sz, ey = i, ez = j;
		}

		days[x].clear(), days[y].clear(), days[z].clear();
		days[x].pb(dd[ex]), days[y].pb(dd[ey]), days[z].pb(dd[ez]);
		while (ex > 0 || ey > 0 || ez > 0) {
			int &sta = prv[ex][ey][ez];
			int pz = sta & 1023, px = sta >> 20, py = sta >> 10 & 1023;
			if (px != ex) {ex = px, days[x].pb(dd[ex]);}
			else if (py != ey) {ey = py, days[y].pb(dd[ey]);}
			else {ez = pz, days[z].pb(dd[ez]);}
		}

		days[x].pop_back();
		days[y].pop_back();
		days[z].pop_back();
		reverse(days[x].begin(), days[x].end());
		reverse(days[y].begin(), days[y].end());
		reverse(days[z].begin(), days[z].end());
		return;
	}
	void update3(VI &_plan) {
		plan = _plan;
		for (int i = 1; i <= MXT; i ++) days[i].clear();
		int d = 0;
		for (auto x : plan) days[x].pb(++ d);

		double TL = 1.8;
		double st = gettime();
		while (elapsed(st) < TL) {
			int x = rng() % MXT + 1;
			int y = rng() % MXT + 1;
			int z = rng() % MXT + 1;
			if (x == y || y == z || x == z) continue;
			update_solve(x, y, z);
		}
		for (int i = 1; i <= MXT; i ++) {
			for (auto x : days[i]) plan[x-1] = i;
		}
		ll score = MyChecker::calc_score(plan);
		update_ans(plan, score);
	}
}

int main() {
//	freopen("sample2.in", "r", stdin);
	input_and_init();
	Greedy::greedy_solve();
//	Update1::update1(best);
//	cerr << best_score << endl;
//	Update2::update2(best);
//	cerr << best_score << endl;
	Update3::update3(best);
	output();
	return 0;
}


Measured memory_bytes: 14264