#include <assert.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

#define SUBMIT

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
					  << " " << __FILE__ << endl;

using namespace std;

const int64_t CYCLES_PER_SEC = 3000000000;
struct Timer {
	int64_t start;
	Timer() { reset(); }
	void reset() { start = getCycle(); }
	void plus(double a) { start -= (a * CYCLES_PER_SEC); }
	inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
	inline int64_t getCycle() {
		uint32_t low, high;
		__asm__ volatile("rdtsc"
						 : "=a"(low), "=d"(high));
		return ((int64_t)low) | ((int64_t)high << 32);
	}
};
class XorShift {
   public:
	unsigned int x, y, z, w;
	double nL[65536];

	XorShift() {
		init();
	}

	void init() {
		x = 314159265;
		y = 358979323;
		z = 846264338;
		w = 327950288;
		double n = 1 / (double)(2 * 65536);
		for (int i = 0; i < 65536; i++) {
			nL[i] = log(((double)i / 65536) + n);
		}
	}

	inline unsigned int next() {
		unsigned int t = x ^ x << 11;
		x = y;
		y = z;
		z = w;
		return w = w ^ w >> 19 ^ t ^ t >> 8;
	}

	inline double nextLog() {
		return nL[next() & 0xFFFF];
	}

	inline int nextInt(int m) {
		return (int)(next() % m);
	}

	int nextInt(int min, int max) {
		return min + nextInt(max - min + 1);
	}

	inline double nextDouble() {
		return (double)next() / ((long long)1 << 32);
	}
};
XorShift rnd;
struct FastSet {
	vector<int> list;
	vector<int> pos;
	void init(int N) {
		pos.resize(N, -1);
		list.reserve(N);
	}
	void insert_all() {
		list.clear();
		list.resize(pos.size());
		for (int i = 0; i < list.size(); i++) {
			pos[i] = list[i] = i;
		}
	}
	void insert(int a) {
		if (pos[a] == -1) {
			pos[a] = list.size();
			list.push_back(a);
		}
	}
	void erase(int a) {
		if (pos[a] >= 0) {
			swap(list[pos[a]], list.back());
			pos[list[pos[a]]] = pos[a];
			pos[a] = -1;
			list.pop_back();
		}
	}
	void flip(int a) {
		if (pos[a] == -1) {
			pos[a] = list.size();
			list.push_back(a);
		} else {
			swap(list[pos[a]], list.back());
			pos[list[pos[a]]] = pos[a];
			pos[a] = -1;
			list.pop_back();
		}
	}
	inline int size() {
		return list.size();
	}
	inline int rand() {
		return list[rnd.nextInt(list.size())];
	}
	inline void erase_all() {
		for (int i : list) {
			pos[i] = -1;
		}
		list.clear();
	}
};
struct FastSet2 {
	vector<int> list;
	vector<int> pos;
	int sz;
	void init(int N) {
		sz = 0;
		pos.resize(N);
		list.resize(N);
		for (int i = 0; i < N; i++) {
			pos[i] = list[i] = i;
		}
	}
	void insert_all() {
		sz = list.size();
	}
	int getAny() {
		return list[sz++];
	}
	void insert(int a) {
		if (pos[a] >= sz) {
			pos[list[sz]] = pos[a];
			swap(list[pos[a]], list[sz]);
			pos[a] = sz;
			sz++;
		}
	}
	void erase(int a) {
		if (pos[a] < sz) {
			sz--;
			pos[list[sz]] = pos[a];
			swap(list[pos[a]], list[sz]);
			pos[a] = sz;
		}
	}
	inline int size() {
		return sz;
	}
	inline int rand() {
		return list[rnd.nextInt(sz)];
	}
	inline void erase_all() {
		sz = 0;
	}
};

const int N = 26;
const int D = 365;
int C[N];
int S[N][D + 1];
int res[D + 1];
int ne[N][D + 2];
int pr[N][D + 2];
int table[D + 1];
struct Solver {
	Timer timer;

	void init() {
		for (int i = 1; i <= D; i++) {
			res[i] = 0;
			int mx = -1;
			for (int j = 0; j < N; j++) {
				if (mx < S[j][i]) {
					mx = S[j][i];
					res[i] = j;
				}
			}
		}
		for (int i = 0; i <= D; i++) {
			table[i] = (i * (i - 1)) / 2;
		}
	}

	int calcScore() {
		int score = 0;
		for (int i = 0; i < N; i++) {
			for (int j = 1; j <= D; j++) {
				pr[i][j] = 0;
				ne[i][j] = D + 1;
			}
		}
		for (int i = 2; i <= D + 1; i++) {
			for (int j = 0; j < N; j++) {
				pr[j][i] = pr[j][i - 1];
			}
			pr[res[i - 1]][i] = i - 1;
		}
		for (int i = D - 1; i >= 0; i--) {
			for (int j = 0; j < N; j++) {
				ne[j][i] = ne[j][i + 1];
			}
			ne[res[i + 1]][i] = i + 1;
		}
		for (int i = 1; i <= D; i++) {
			score += S[res[i]][i];
			score -= C[res[i]] * table[ne[res[i]][i] - i];
		}
		for (int i = 0; i < N; i++) {
			score -= C[i] * table[ne[i][0]];
		}
		return score;
	}

	void SA(double timelimit) {
		double st = timer.get();
		double ti = st;

		double dd = st;
		double interval = (timelimit - st) / 10;
		double T0 = 4000;
		double T1 = 50;
		//double T0 = 10000;
		//double T1 = 5000;

		double T = T0;
		int score = calcScore();
		int bestscore = score;
		int cnt = 0;
		int best[D + 1];
		for (int i = 1; i <= D; i++) {
			best[i] = res[i];
		}

		double TT0;
		double nm = 1.0 / (timelimit - st);
		while (true) {
			ti = timer.get();
			if (ti > timelimit) break;
			if ((cnt & 0xFFFF) == 0) {
				double rem = (timelimit - ti) * nm;
				T = (T0 - T1) * rem + T1;
#ifndef SUBMIT
				if (ti > dd) {
					dd += interval;
					cerr << T << " " << score << " " << bestscore << endl;
				}
#endif
			}

			cnt++;
			if (rnd.next() & 1) {
				int a = rnd.nextInt(D) + 1;
				int b = rnd.nextInt(N - 1);
				if (b >= res[a]) b++;

				//res[a] = b;
				int x = res[a];
				int diff = 0;

				diff += C[x] * (table[a - pr[x][a]] + table[ne[x][a] - a] - table[ne[x][a] - pr[x][a]]);

				diff -= C[b] * (table[a - pr[b][a]] + table[ne[b][a] - a] - table[ne[b][a] - pr[b][a]]);

				diff -= S[x][a];
				diff += S[b][a];

				if (diff > T * rnd.nextLog()) {
					//if (diff > -T * rnd.nextDouble()) {
					res[a] = b;
					score += diff;
					if (bestscore < score) {
						bestscore = score;
						for (int i = 1; i <= D; i++) {
							best[i] = res[i];
						}
					}
					for (int i = a + 1; i <= ne[x][a]; i++) {
						pr[x][i] = pr[x][a];
					}
					for (int i = a - 1; i >= pr[x][a]; i--) {
						ne[x][i] = ne[x][a];
					}
					for (int i = a + 1; i <= ne[b][a]; i++) {
						pr[b][i] = a;
					}
					for (int i = a - 1; i >= pr[b][a]; i--) {
						ne[b][i] = a;
					}
				}
			} else {
				int a = rnd.nextInt(D) + 1;
				int xa = res[a];
				int xb = rnd.nextInt(N - 1);
				if (xb >= xa) xb++;
				int b;
				if (rnd.next() & 1) {
					b = ne[xb][a];
					if (b >= ne[xa][a]) continue;
				} else {
					b = pr[xb][a];
					if (b <= pr[xa][a]) continue;
					//swap(a, b);
					//swap(xa, xb);
				}
				// assert(res[b] == xb);
				// assert(pr[xb][b] < a && a < ne[xb][b]);
				// assert(pr[xa][a] < b && b < ne[xa][a]);
				int diff = 0;
				int na = ne[xa][a];
				int pa = pr[xa][a];
				diff += C[xa] *
						(table[na - a] + table[a - pa] - table[na - b] - table[b - pa]);
				int nb = ne[xb][b];
				int pb = pr[xb][b];
				diff += C[xb] *
						(table[nb - b] + table[b - pb] - table[nb - a] - table[a - pb]);

				diff -= S[xa][a];
				diff += S[xa][b];

				diff += S[xb][a];
				diff -= S[xb][b];

				if (diff > T * rnd.nextLog()) {
					//if (diff > -T * rnd.nextDouble()) {
					res[a] = xb;
					res[b] = xa;
					score += diff;
					if (bestscore < score) {
						bestscore = score;
						for (int i = 1; i <= D; i++) {
							best[i] = res[i];
						}
					}

					for (int i = pa; i < b; i++) {
						ne[xa][i] = b;
					}
					for (int i = b; i < a; i++) {
						ne[xa][i] = na;
					}
					for (int i = na; i > b; i--) {
						pr[xa][i] = b;
					}
					for (int i = b; i > a; i--) {
						pr[xa][i] = pa;
					}

					for (int i = pb; i < a; i++) {
						ne[xb][i] = a;
					}
					for (int i = a; i < b; i++) {
						ne[xb][i] = nb;
					}
					for (int i = nb; i > a; i--) {
						pr[xb][i] = a;
					}
					for (int i = a; i > b; i--) {
						pr[xb][i] = pb;
					}
				}
			}
		}
		for (int i = 1; i <= D; i++) {
			res[i] = best[i];
		}
#ifndef SUBMIT
		dump(cnt);
		score = bestscore;
		cerr << score << endl;
		score = calcScore();
		cerr << score << endl;
		cerr << (score + 1000000) * 50 << endl;
#endif
	}

	int
	solve() {
		init();
#ifdef SUBMIT
		double tl = 1.97;
#else
		double tl = 1.5;
#endif
		SA(tl);
		return 0;
	}

	void input() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		int _;
		cin >> _;
		for (int i = 0; i < N; i++) {
			cin >> C[i];
		}
		for (int j = 1; j <= D; j++) {
			for (int i = 0; i < N; i++) {
				cin >> S[i][j];
			}
		}
	}
	void generate() {
		for (int i = 0; i < 20000; i++) {
			rnd.next();
		}
		for (int i = 0; i < N; i++) {
			C[i] = rnd.nextInt(101);
		}
		for (int j = 1; j <= D; j++) {
			for (int i = 0; i < N; i++) {
				S[i][j] = rnd.nextInt(20001);
			}
		}
	}

	void output() {
		for (int i = 1; i <= D; i++) {
			cout << res[i] + 1 << endl;
		}
	}
};

Solver solver;
int main(int argc, char *argv[]) {
#ifdef SUBMIT
	solver.input();
#else
	solver.generate();
#endif
	solver.solve();
#ifdef SUBMIT
	solver.output();
#endif
	cerr << "timer = " << solver.timer.get() << endl;
	return 0;
}

Measured memory_bytes: 4816