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

#define N 26
#define MAX_T 1.9
#define TRIAL 5

const long INF = 1L << 60;

int c[N];
int s[365][N];
// vector<int> sorted[365];

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

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);
		score += c[qq] * (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);
		score -= c[qq] * (range(*litr, *itr) + range(*itr, *ritr));
		held[qq].erase(itr);
	}

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

	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-2;
	// 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();
}

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 t = 0;
	ContestInfo ci(d);
	for (int i = 0; i < d; i++) {
		t = max_element(s[i], s[i] + N) - s[i];
		ci.add(i, t);
	}

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

	int dd, qq;
	while (toc() < MAX_T) {
		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 < ci.score) {
				ci.save();
			}
		}
	}
	ci.output();
}

Measured memory_bytes: 3684