#include <bits/stdc++.h>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

std::vector<int> solve26(int n, const std::vector<int> &c, const std::vector<std::vector<int> > &val) {
	auto score = [&] (const std::vector<int> &part) {
		int last[26];
		for (auto &i : last) i = -1;
		int res = 0;
		for (int i = 0; i < n; i++) {
			int cur = part[i % 26];
			last[cur] = i;
			for (int j = 0; j < 26; j++) res -= c[j] * (i - last[j]);
			res += val[i][cur];
		}
		return res;
	};
	std::vector<int> cur(26);
	std::iota(cur.begin(), cur.end(), 0);
	int cur_score = score(cur);
	
	std::random_device rnd_dev;
	std::mt19937 rnd(rnd_dev() ^ time(NULL));
	
	clock_t start = clock();
	while (1) {
		clock_t cur_time = clock();
		if (cur_time - start > 0.3 * CLOCKS_PER_SEC) break;
		int r0 = std::uniform_int_distribution<>(0, 25)(rnd);
		int r1 = std::uniform_int_distribution<>(0, 25)(rnd);
		std::swap(cur[r0], cur[r1]);
		int new_score = score(cur);
		if (new_score >= cur_score) cur_score = new_score;
		else std::swap(cur[r0], cur[r1]);
	}
	
	return cur;
}


std::vector<int> solve(int n, const std::vector<int> &c, const std::vector<std::vector<int> > &val) {
	auto score = [&] (const std::vector<int> &all) {
		int last[26];
		for (auto &i : last) i = -1;
		int res = 0;
		for (int i = 0; i < n; i++) {
			int cur = all[i];
			last[cur] = i;
			for (int j = 0; j < 26; j++) res -= c[j] * (i - last[j]);
			res += val[i][cur];
		}
		return res;
	};
	clock_t start = clock();
	
	auto r26 = solve26(n, c, val);
	
	std::vector<int> cur(n);
	for (int i = 0; i < n; i++) cur[i] = r26[i % 26];
	int cur_score = score(cur);
	int best_score = -1000000000;
	std::vector<int> best;
	
	std::random_device rnd_dev;
	std::mt19937 rnd(rnd_dev() ^ time(NULL));
	
	while (1) {
		clock_t cur_time = clock();
		if (cur_time - start > 1.95 * CLOCKS_PER_SEC) break;
		int r0 = std::uniform_int_distribution<>(0, n - 1)(rnd);
		int r1 = std::uniform_int_distribution<>(0, n - 1)(rnd);
		std::swap(cur[r0], cur[r1]);
		double threshold = 1.95 - (double) (cur_time - start) / CLOCKS_PER_SEC;
		// std::cerr << threshold << std::endl;
		int new_score = score(cur);
		if (new_score > best_score * (1 - threshold * 0.01)) cur_score = new_score;
		else std::swap(cur[r0], cur[r1]);
		if (best_score < cur_score) best_score = cur_score, best = cur;
	}
	
	return best;
}

void input() {
	int n = ri();
	std::vector<int> c(26);
	for (auto &i : c) i = ri();
	std::vector<std::vector<int> > val(n, std::vector<int>(26));
	for (auto &i : val) for (auto &j : i) j = ri();
	for (auto i : solve(n, c, val)) printf("%d\n", i + 1);
}

void random_test() {
	std::random_device rnd_dev;
	std::mt19937 rnd(rnd_dev() ^ time(NULL));
	
	int n = 365;
	std::vector<int> c(26);
	for (auto &i : c) i = std::uniform_int_distribution<>(0, 100)(rnd);
	std::vector<std::vector<int> > val(n, std::vector<int>(26));
	for (auto &i : val) for (auto &j : i) j = std::uniform_int_distribution<>(0, 20000)(rnd);
	
	auto res = solve(n, c, val);
	
	
	int last[26];
	for (auto &i : last) i = -1;
	int score = 0;
	for (int i = 0; i < n; i++) {
		last[res[i]] = i;
		for (int j = 0; j < 26; j++) score -= c[j] * (i - last[j]);
		score += val[i][res[i]];
	}
	printf("%d\n", score);
}

int main() {
#	ifdef LOCAL
	random_test();
#	else
	input();
#	endif
	return 0;
}



Measured memory_bytes: 3928