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

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

const long INF = 1L << 60;
const double T0 = 6e3;
const double T1 = 4e2;
const double TL = 1.95;
const int kb = 3;
const int ke = 7;

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

chrono::time_point<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(1, 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(long diff, double T) {
	// cnt += exp(diff / T) < dice();
	// cout << exp(diff / T) << endl;
	return exp(diff / T);
}

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

double toc() {
	endt = chrono::steady_clock::now();
	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();
	ContestInfo ci(d);
	for (int i = 0; i < d; i++) {
		ci.add(i, dist_int(generator) % N);
	}
	ci.save();

	double T = T0;
	int dd, qq, cnt_all = 0;
	while (true) {
		cnt_all++;
		if (cnt_all % 100 == 0) {
			double pt = toc() / TL;
			if (pt > 1.0) break;
			T = pow(T0, 1.0 - pt) * pow(T1, pt);
		}

		long current_score = ci.score;
		if (dist_real(generator) < 0.5) {
			dd = dist_int(generator) % d;
			qq = dist_int(generator) % N;
			int old_q = ci.t[dd];
			ci.change(dd, qq);
			if (ci.score < current_score && prob(ci.score - current_score, T) < dice()) {
				ci.change(dd, old_q);
			}
		} 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);
			if (ci.score < current_score && prob(ci.score - current_score, T) < dice()) {
				ci.swap(d1, q2, d2, q1);
			}
		}
		if (ci.best_score < ci.score) {
			ci.save();
			// print_time();
		}
	}
	ci.output();
	// cout << cnt_all << " " << cnt << endl;
	// print_time();
}

Measured memory_bytes: 4392