#include <bits/stdc++.h>
using namespace std;

constexpr int64_t INF = 1e18;

uint32_t xor128() { 
	static uint32_t x = 123456789;
	static uint32_t y = 362436069;
	static uint32_t z = 521288629;
	static uint32_t w = 88675123; 
	uint32_t t;
	t = x ^ (x << 11);
	x = y; y = z; z = w;
	return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); 
}

int rnd(int maxi) {
	return xor128() % maxi;
}

constexpr double TIMELIMIT = 2.05;
struct Timer {
	static constexpr int64_t CYCLES_PER_SEC = 2800000000;
	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);
	}
};
Timer timer;

struct Input {
	static constexpr int N = 26;
	static constexpr int D = 365;
	vector<int64_t> c;
	vector<vector<int64_t>> s;
	Input() : c(N), s(D, vector<int64_t>(N)) {
		input();
	}
	private: void input() {
		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];
			}
		}
	}
};

struct Output {
	vector<int> t;
	Output() : t(Input::D) {}
	void print() {
		for(int i = 0; i < Input::D; ++i) {
			cout << t[i] + 1 << '\n';
		}
	}
};

struct State {
	const Input& in;
	Output out;
	int64_t score;
	vector<vector<int>> days;
	State(const Input& in) : in(in), days(Input::N) {
		for(int i = 0; i < Input::N; ++i) {
			days[i].push_back(0);
			days[i].push_back(Input::D + 1);
		}
	}
	void change_contest(int d, int q) {
		{
			int pre_q = out.t[d];
			auto itr = lower_bound(days[pre_q].begin(), days[pre_q].end(), d + 1);
			int prev_day = *prev(itr);
			int next_day = *next(itr);
			days[pre_q].erase(itr);
			score += (diff_score(prev_day, d + 1) + diff_score(d + 1, next_day) - diff_score(prev_day, next_day)) * in.c[pre_q];
			score -= in.s[d][pre_q];
		}
		{
			insert_contest(d + 1, q);
			auto itr = lower_bound(days[q].begin(), days[q].end(), d + 1);
			int prev_day = *prev(itr);
			int next_day = *next(itr);
			score -= (diff_score(prev_day, d + 1) + diff_score(d + 1, next_day) - diff_score(prev_day, next_day)) * in.c[q];
			score += in.s[d][q];
		}
		out.t[d] = q;
	}
	void insert_contest(int d, int q) {
		days[q].insert(lower_bound(days[q].begin(), days[q].end(), d), d);
	}
	int64_t diff_score(int l, int r) {
		int d = r - l;
		return d * (d - 1) / 2;
	}
	int64_t calc_score(const Input& in) {
		int64_t score = 0;
		int last[Input::N] = {};
		for(int d = 0; d < Input::D; ++d) {
			last[out.t[d]] = d + 1;
			for(int i = 0; i < Input::N; ++i) {
				score -= (d + 1 - last[i]) * in.c[i];
			}
			score += in.s[d][out.t[d]];
		}
		return score;
	}
};

State greedy(const Input& in) {
	State state(in);
	int last[Input::N] = {};
	for(int d = 0; d < Input::D; ++d) {
		int64_t score = 0;
		for(int i = 0; i < Input::N; ++i) {
			score -= (d + 1 - last[i]) * in.c[i];
		}
		int64_t max_score = -INF;
		int best_i = 0;
		for(int i = 0; i < Input::N; ++i) {
			int64_t nxt_score = score + in.s[d][i];
			if(nxt_score > max_score) {
				max_score = nxt_score;
				best_i = i;
			}
		}
		state.out.t[d] = best_i;
		state.insert_contest(d + 1, best_i);
	}
	state.calc_score(in);
	return state;
}

State solve(const Input& in) {
	State state = greedy(in);
	while(timer.get() < TIMELIMIT) {
		if(rnd(2) & 1) {
			int d = rnd(Input::D);
			int q = rnd(Input::N);
			int pre_q = state.out.t[d];
			int64_t pre_score = state.score;
			state.change_contest(d, q);
			int64_t new_score = state.score;
			if(new_score <= pre_score) {
				state.change_contest(d, pre_q);
			}
		} else {
			int d1 = rnd(Input::D);
			int q1 = state.out.t[d1];
			int d2 = rnd(Input::D);
			int q2 = state.out.t[d2];
			int64_t pre_score = state.score;
			state.change_contest(d1, q2);
			state.change_contest(d2, q1);
			int64_t new_score = state.score;
			if(new_score <= pre_score) {
				state.change_contest(d1, q1);
				state.change_contest(d2, q2);
			}
		}
	}
	return state;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	Input in;
	State state = solve(in);
	state.out.print();
	return 0;
}


Measured memory_bytes: 3796