#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;

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 Update {
	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].pb(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 < 1000; step ++) {
			ll prv = score;
			random_days.clear();
			while (random_days.size() < 3) {
				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]);
		}
		update_ans(plan, score);
	}
}

int main() {
//	freopen("sample2.in", "r", stdin);
	input_and_init();
	Greedy::greedy_solve();
	Update::update1(best);
	output();
	return 0;
}


Measured memory_bytes: 3868