//ビームサーチ
#include <iostream>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <cassert>
#include <ctime>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

const int N = 26;
int D;
int c[N];
int s[365][N];

struct State {
	int lasts[N];
	int day, score;
	
	State() {}
	State(int lasts[], int day, int score) {
		for (int i = 0; i < 26; i++) this->lasts[i] = lasts[i];
		this->day = day;
		this->score = score;
	}

	//次の日t(0～25). 状態の更新.
	State next_state(int t) {
		State ret = *this;
		ret.lasts[t] = day;
		ret.score = score + s[day][t];
		for (int i = 0; i < N; i++) {
			ret.score -= c[i] * (day - ret.lasts[i]);
		}
		ret.day++;
		return ret;
	}

	bool operator>(const State &r) const {
		return score > r.score;
	}

	bool operator==(State &r) {
		if (day != r.day) return false;
		if (score != r.score) return false;
		for (int i = 0; i < 26; i++) if (lasts[i] != r.lasts[i]) return false;
		return true;
	}
};

namespace Yama {
	namespace Random {
		unsigned int y = 1;
		void setSeed(unsigned int seed) {
			y = seed;
		}
		unsigned int rand() {
			y = y ^ (y << 13);
			y = y ^ (y >> 17);
			y = y ^ (y << 15);
			return y;
		}
	}

	set<int> lasts[26];
	int t[365];

	int calc_next_score(int score, int d, int b) {
		int a = t[d];
		
		//aを消す
		set<int>::iterator itL = prev(lasts[a].lower_bound(d));
		set<int>::iterator itR = lasts[a].upper_bound(d);
		score -= c[a] * (d - *itL) * (*itR - d);
		score -= s[d][a];
		
		//bを追加する
		itL = prev(lasts[b].lower_bound(d));
		itR = lasts[b].upper_bound(d);
		score += c[b] * (d - *itL) * (*itR - d);
		score += s[d][b];
		return score;
	}

	void update_state(int d, int b) {
		int a = t[d];
		lasts[a].erase(d);
		lasts[b].insert(d);
		t[d] = b;
	}

	int yama(int t[]) {
		int i, j;
		Random::setSeed(252521);
		rep(i, N) Yama::t[i] = t[i];

		int score = 0;
		rep(i, D) score += s[i][t[i]];
		
		rep(i, N) {
			int last = -1;
			int damage = 0;
			
			lasts[i].insert(-1);
			lasts[i].insert(D);
			rep(j, D) {
				if (t[j] == i) {
					last = j;
					lasts[i].insert(j);
				}
				damage += j - last;
			}
			score -= c[i] * damage;
		}

		clock_t start = clock();
		while (clock() - start < 1000) {
			int d = Random::rand() % D;
			int q = Random::rand() % N;
			int next_score = calc_next_score(score, d, q);
			if (score < next_score) {
				score = next_score;
				update_state(d, q);
				score = next_score;
			}
		}
		rep(i, N) t[i] = Yama::t[i];
		
		return score;
	}
}

int width = 500;
priority_queue<State, vector<State>, greater<State>> que[366];
vector<State> states[366];

int main() {
	int i, j;

	cin >> D;
	rep(i, N) cin >> c[i];
	rep(i, D) rep(j, N) cin >> s[i][j];

	int lasts[N];
	rep(i, N) lasts[i] = -1;
	State init_state(lasts, 0, 0);

	que[0].push(init_state);
	rep(i, D) {
		while (!que[i].empty()) {
			State now = que[i].top();
			states[i].push_back(now);
			que[i].pop();
			
			rep(j, N) {
				State next_s = now.next_state(j);
				que[i + 1].push(next_s);
				if (que[i + 1].size() > width) {
					que[i + 1].pop();
				}
			}
		}
	}

	State final_state = que[D].top();
	cerr << "score = " << final_state.score << endl;

	//というわけで出力.
	int ans[365];
	for (i = D - 1; i >= 0; i--) {
		for (j = 0; j < states[i].size(); j++) {
			int k;
			rep(k, N) {
				State next_state = states[i][j].next_state(k);
				if (next_state == final_state) {
					ans[i] = k;
					final_state = states[i][j];
					break;
				}
			}
			if (k < N) break;
		}
		if (j == states[i].size()) assert(0);
	}

	int score = Yama::yama(ans);
	cerr << "score = " << score << endl;

	rep(i, D) cout << ans[i] + 1 << endl;
	return 0;
}

Measured memory_bytes: 44276