#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

#define N 26
#define MAX_T 1.95
#define TRIAL 5
#define K 16

const long INF = 1L << 60;

int c[N];
int s[365][N];
int last[N];

std::chrono::time_point<std::chrono::steady_clock> start, endt;

random_device rd;
mt19937 generator(rd());
uniform_real_distribution<> dist_real(0.0, 1.0);
uniform_int_distribution<> dist_int(0, RAND_MAX);
uniform_int_distribution<> dist_int_k(0, K);

struct ContestInfo {
	int D;
	long score;
	long best_score;
	vector<int> t;
	vector<int> best_t;
	set<int> held[N];
	ContestInfo(int dd) : D(dd), score(0) {
		t.resize(D, -1);
		for (int i = 0; i < N; i++) {
			held[i].insert(-1);
			held[i].insert(D);
			score -= c[i] * D * (D + 1) / 2;
		}
	}

	void add(int dd, int qq) {
		if (t[dd] != -1) {
			cout << "Add faild!" << endl;
			exit(1);
		}

		t[dd] = qq;
		score += s[dd][qq];
		auto itr = held[qq].insert(dd).first;
		auto ritr = next(itr);
		auto litr = prev(itr);
		auto range = [](int l, int r) {
			int k = r - l - 1;
			return -k * (k + 1) / 2;
		};
		score -= c[qq] * (range(*litr, *ritr) - range(*litr, *itr) - range(*itr, *ritr));
	}

	void erase(int dd) {
		if (t[dd] == -1) {
			cout << "Erase faild!" << endl;
			exit(1);
		}
		int qq = t[dd];
		t[dd] = -1;
		score -= s[dd][qq];
		auto itr = held[qq].find(dd);
		auto ritr = next(itr);
		auto litr = prev(itr);
		auto range = [](int l, int r) {
			int k = r - l - 1;
			return -k * (k + 1) / 2;
		};
		score += c[qq] * (range(*litr, *ritr) - range(*litr, *itr) - range(*itr, *ritr));
		held[qq].erase(itr);
	}

	void change(int dd, int qq) {
		erase(dd);
		add(dd, qq);
	}

	void swap(int d1, int q1, int d2, int q2) {
		change(d1, q2);
		change(d2, q1);
	}

	long calc_score(int dd) {
		long ret = 0;
		fill(last, last + N, -1);
		for (int i = 0; i <= dd; i++) {
			ret += s[i][t[i]];
			last[t[i]] = i;
			for (int j = 0; j < N; j++) {
				ret -= c[j] * (i - last[j]);
			}
		}
		return ret;
	}

	long evaluate(int dd, int k = K) {
		long ret = calc_score(dd);
		for (int i = dd; i < min(D, dd + k); i++) {
			for (int j = 0; j < N; j++) {
				ret -= c[j] * (i - last[j]);
			}
		}
		return ret;
	}

	void save() {
		best_t = t;
		best_score = score;
	}

	void output(bool show = false) {
		for (int i = 0; i < D; i++)
			cout << best_t[i] + 1 << endl;
		if (show) cout << best_score << endl;
	}
};

double dice() {
	return dist_real(generator);
}

double prob(double rem) {
	return 1.0 - 1e-3;
	// return 1.0 / exp(rem);
	// return 1.0 / pow(8, rem);
	// return dist_real(generator);
}

void tic() {
	start = std::chrono::steady_clock::now();
}

double toc() {
	endt = std::chrono::steady_clock::now();
	std::chrono::duration<double> elapsed_seconds = endt - start;
	return elapsed_seconds.count();
}

void print_time() {
	cout << "time : " << toc() << endl;
}

int main() {
	int d;
	cin >> d;
	for (int i = 0; i < N; i++)
		cin >> c[i];
	for (int i = 0; i < d; i++) {
		for (int j = 0; j < N; j++) {
			cin >> s[i][j];
		}
	}

	tic();
	int best_k = 0;
	long best_score = -INF;
	vector<ContestInfo> cis;
	for (int k = 3; k <= 7 && toc() < 1.0; k++) {
		auto &ci = cis.emplace_back(d);
		for (int i = 0; i < d; i++) {
			long max_score = -INF;
			int best_q = 0;
			for (int j = 0; j < N; j++) {
				ci.add(i, j);
				long new_score = ci.evaluate(i, k);
				if (max_score < new_score) {
					max_score = new_score;
					best_q = j;
				}
				ci.erase(i);
			}
			ci.add(i, best_q);
		}
		if (best_score < ci.score) {
			best_k = k - 3;
			best_score = ci.score;
		}
	}
	auto &ci = cis[best_k];

	long current_score = ci.score;
	ci.save();

	int dd, qq;
	while (toc() < MAX_T) {
		if (dist_real(generator) < 0.5) {
			dd = dist_int(generator) % d;
			int old_q = ci.t[dd];
			int new_q = -1;
			long new_score = -INF;
			for (int i = 0; i < TRIAL; i++) {
				// qq = sorted[dd][i];
				qq = dist_int(generator) % N;
				ci.change(dd, qq);
				if (new_score < ci.score) {
					new_score = ci.score;
					new_q = qq;
				}
			}
			// if (new_score < current_score) {
			if (new_score < current_score && prob(MAX_T - toc()) > dice()) {
				ci.change(dd, old_q);
			} else {
				current_score = new_score;
				ci.change(dd, new_q);
				if (ci.best_score < current_score) {
					ci.save();
					// print_time();
				}
			}
		} else {
			int d1 = dist_int(generator) % (d - 1);
			int d2 = min(d - 1, d1 + dist_int_k(generator));
			int q1 = ci.t[d1];
			int q2 = ci.t[d2];
			ci.swap(d1, q1, d2, q2);
			int new_score = ci.score;
			if (new_score < current_score) {
				ci.swap(d1, q2, d2, q1);
			} else {
				current_score = new_score;
				if (ci.best_score < current_score) {
					ci.save();
					// print_time();
				}
			}
		}
	}
	ci.output();
	// print_time();
}

Measured memory_bytes: 3792