#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define all(x) x.begin(), x.end()

#define pb push_back

using VI = vector <int>;
using ll = long long;

const ll inf = 0x3f3f3f3f3f3f3f3f;
const int MXT = 26;
const int MXD = 365;

int D;
int C[MXT+10], S[MXD+10][MXT+10];

VI best;
ll best_score;

inline unsigned long long rdtsc() {
#ifdef __amd64
	unsigned long long a, d;
	__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
	return (d << 32) | a;
#else
	unsigned long long x;
	__asm__ volatile ("rdtsc" : "=A" (x));
	return x;
#endif
}
inline double gettime(){return rdtsc()/2993344000.0;}
inline double elapsed(double st){return gettime()-st;}

namespace MyChecker {
	int last[MXT+10];
	ll calc_score(VI ans = best) {
		fill_n(last + 1, MXT+1, 0);
		if (ans.size() != D) {puts("Wrong Answer"); assert(0);}
		int d = 0;
		ll score = 0;
		for (auto x : ans) {
			++ d;
			if (x) {
				score += S[d][x];
				last[x] = d;
			}
			for (int i = 1; i <= MXT; i ++) score -= 1ll * C[i] * (d - last[i]);
		}
		return max(0ll, score + 1000000);
	}
}

void update_ans(VI &current, ll new_score = -inf) {
	if (new_score == -inf) new_score = MyChecker::calc_score(current);
	if (best.empty() || best_score < new_score) {
		best_score = new_score;
		best = current;
	}
	return;
}

void input_and_init() {
	scanf("%d", &D);
	for (int i = 1; i <= MXT; i ++) scanf("%d", &C[i]);
	for (int i = 1; i <= D; i ++) {
		for (int j = 1; j <= MXT; j ++) scanf("%d", &S[i][j]);
	}
	best.clear();
	return;
}
void output() {
	for (auto x : best) printf("%d\n", x);
}

namespace Greedy {
	int last[MXT+10];
	ll greedy(double param) {
		fill_n(last, MXT+1, 0);
		ll delta[MXT + 1] = {0};
		VI greedy_ans;
		ll score = 0;
		for (int i = 1; i <= D; i ++) {
			for (int j = 1; j <= MXT; j ++) delta[j] += C[j];
			ll sum = accumulate(delta + 1, delta + MXT + 1, 0ll);
			double mx = -2e18; int ansd = -1;
			for (int j = 1; j <= MXT; j ++) {
				double val = param * delta[j] + S[i][j];
				if (mx < val) mx = val, ansd = j;
			}
			score += S[i][ansd] + delta[ansd] - sum;
			delta[ansd] = 0; last[ansd] = i;
			greedy_ans.pb(ansd);
		}
		update_ans(greedy_ans, max(score + 1000000, 0ll));
		return score;
	}
	void greedy_solve() {
		for (double x = 1; x <= 10; x += 1) greedy(x);
	}
}

namespace Update4 {
	VI plan;
	int left[MXD+10][MXT+1], right[MXD+10][MXT+1];
	void init(VI &_plan) {
		plan = _plan;
		int d;
		fill(left[0], left[0] + 27, 0);
		d = 0;
		for (auto x : plan) {
			++ d;
			copy(left[d-1], left[d-1] + 27, left[d]);
			left[d][x] = d;
		}
		reverse(all(plan));
		fill(right[366], right[366] + 27, 366);
		d = 366;
		for (auto x : plan) {
			d --;
			copy(right[d+1], right[d+1] + 27, right[d]);
			right[d][x] = d;
		}
		reverse(all(plan));
	}

	struct FLOW {
		static const int inf = 0x3f3f3f3f;
		int cost[MXT+10][MXT+10], wb[MXT+10],wg[MXT+10];
		int slc[MXT+10], n, bg[MXT+10];
		bool b[MXT+10], g[MXT+10];
		void init(int _n) {
			n = _n;
			return;
		}
		void add_edge(int x, int y, int w) {
			cost[x][y] = w;
			return;
		}
		bool dfs(int girl) {
			g[girl] = 1;
			for (int boy = 1; boy <= n; boy ++) {
				if (b[boy]) continue;
				int val = wg[girl] + wb[boy] - cost[girl][boy];
				if (!val) {
					b[boy] = 1;
					if (bg[boy] == -1 || dfs(bg[boy])){
						bg[boy] = girl;
						return 1;
					}
				}
				else slc[boy] = min(slc[boy], val);
			}
			return 0;
		}
		int KM() {
			int res = 0;
			for (int i = 1; i <= n; i ++) wb[i] = 0, bg[i] = -1;
			for (int i = 1; i <= n; i ++) {
				wg[i] = cost[i][1];
				for (int j = 2; j <= n; j ++) wg[i] = max(wg[i], cost[i][j]);
			}
			for (int i = 1; i <= n; i ++) {
				for (int j = 1; j <= n; j ++) slc[j] = inf;
				while (1) {
					for (int j = 1; j <= n; j ++) b[j] = g[j] = 0;
					if (dfs(i)) break;
					int d = inf;
					for (int j = 1; j <= n; j ++)
					if (!b[j]) d = min(d, slc[j]);
					for (int j = 1; j <= n; j ++) {
						if (g[j]) wg[j] -= d;
						if (b[j]) wb[j] += d;
						else slc[j] -= d;
					}
				}
			}
			for (int i = 1; i <= n; i ++) res += cost[bg[i]][i];
			return res;
		}
	} D;

	int calc_change_score(int d, int t) {
		return S[d][t] + (right[d+1][t] - d) * (d - left[d-1][t]) * C[t];
	}
	void Erase(int d, int t) {
		int dw = left[d-1][t], up = right[d+1][t];
		for (int i = d; i > dw; i --) right[i][t] = up;
		for (int i = d; i < up; i ++) left[i][t] = dw;
	}
	void Add(int d, int t) {
		int dw = left[d][t], up = right[d][t];
		for (int i = d; i > dw; i --) right[i][t] = d;
		for (int i = d; i < up; i ++) left[i][t] = d;
	}
	void solve(VI SD) {
		D.init(MXT);
		for (auto x : SD) {
			Erase(x, plan[x-1]);
		}
		for (int i = 0; i < SD.size(); i ++) {
			for (int j = 1; j <= MXT; j ++) {
				int tmp = calc_change_score(SD[i], j);
				D.add_edge(i+1, j, tmp);
			}
		}
		for (int i = SD.size(); i < MXT; i ++) for (int j = 1; j <= MXT; j ++) D.add_edge(i+1, j, 0);
		int scr = D.KM();
		for (int i = 1; i <= MXT; i ++) {
			if (D.bg[i] <= SD.size()) {
				Add(SD[D.bg[i]-1], i);
				plan[SD[D.bg[i]-1]-1] = i;
			}
		}
		return;
	}
	void update4(VI &_plan) {
		init(_plan);
		int sz = plan.size();

		double TL = 1.8;
		double st = gettime();

		while (elapsed(st) < TL) {
			int L = rand() % (sz - 14), R;
			int cur = 0;
			for (R = L; R < sz; R ++) {
				if (cur & (1<<plan[R])) break;
				cur ^= 1<<plan[R];
			}
          	if (R - L <= 5) continue;
			VI SD;
			for (int i = L; i < R; i ++) SD.pb(i+1);
			solve(SD);
		}
		ll score = MyChecker::calc_score(plan);
		update_ans(plan, score);
		return;
	}
}

int main() {
	input_and_init();
	Greedy::greedy_solve();

	Update4::update4(best);

	output();
	return 0;
}


Measured memory_bytes: 3928