//include
//------------------------------------------
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>

#include <sstream>
#include <iostream>
#include <iomanip>

#include <complex>
#include <numeric>
#include <utility>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>

#include <random>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
const double TLE = 1.95;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

ll score(const vector<ll>& cs, const vector<vector<ll>>& ss, const vector<ll>& ts) {
	vector<ll> vs(ts.size());
	vector<ll> lasts(26);

	for (ll i = 0; i < ts.size(); ++i) {
		if (i > 0) vs[i] = vs[i - 1LL];
		ll t = ts[i];
		vs[i] += ss[i][t];
		for (ll j = 0; j < 26; ++j) {
			++lasts[j];
			if (j == t) lasts[j] = 0;
			vs[i] -= cs[j] * lasts[j];
		}
	}

	return vs[ts.size() - 1LL];
}

ll change(
	const vector<ll>& cs,
	const vector<vector<ll>>& ss,
	const vector<ll>& ts,
	ll curr_score,
	ll d, ll new_t)
{
	ll curr_t = ts[d];
	ll score = curr_score;

	{
		ll curr_left_idx = -1;
		for (ll i = 0; i < d; ++i) if (ts[i] == curr_t) curr_left_idx = max(curr_left_idx, i);
		ll curr_right_idx = ts.size();
		for (ll i = ts.size() - 1LL; i > d; --i) if (ts[i] == curr_t) curr_right_idx = min(curr_right_idx, i);
		score -= ss[d][curr_t];
		score += cs[curr_t] * (d - curr_left_idx) * (d - curr_left_idx - 1LL) / 2LL;
		score += cs[curr_t] * (curr_right_idx - d) * (curr_right_idx - d - 1LL) / 2LL;
		score -= cs[curr_t] * (curr_right_idx - curr_left_idx) * (curr_right_idx - curr_left_idx - 1LL) / 2LL;

	}

	{
		ll new_left_idx = -1;
		for (ll i = 0; i < d; ++i) if (ts[i] == new_t) new_left_idx = max(new_left_idx, i);
		ll new_right_idx = ts.size();
		for (ll i = ts.size() - 1LL; i > d; --i) if (ts[i] == new_t) new_right_idx = min(new_right_idx, i);
		score += ss[d][new_t];
		score -= cs[new_t] * (d - new_left_idx) * (d - new_left_idx - 1LL) / 2LL;
		score -= cs[new_t] * (new_right_idx - d) * (new_right_idx - d - 1LL) / 2LL;
		score += cs[new_t] * (new_right_idx - new_left_idx) * (new_right_idx - new_left_idx - 1LL) / 2LL;
	}

	return score;
}

vector<ll> greedy_search(
	const vector<ll>& cs,
	const vector<vector<ll>>& ss)
{
	ll D = ss.size();

	vector<ll> ts(D);
	vector<ll> lasts(26);

	for (ll i = 0; i < D; ++i) {
		for (ll j = 0; j < 26; ++j) {
			++lasts[j];
		}
		ll best_t;
		ll best_score = -1;
		for (ll t = 0; t < 26; ++t) {
			ll score = ss[i][t] + cs[t] * lasts[t];
			if (best_score < score) {
				best_t = t;
				best_score = score;
			}
		}
		ts[i] = best_t;
		lasts[best_t] = 0;
	}

	return ts;
}

bool update(ll curr_score, ll new_score, ll t, mt19937_64 mt) {
	if (new_score > curr_score) return true;

	ll delta = new_score - curr_score;
	double prob = double(mt() % 10000LL) / 10000LL;
	if (prob < exp(double(delta) / t)) return true;

	return false;
}

int solve() {
	random_device seed_gen;
	mt19937_64 engine(seed_gen());

	double T0 = 2000;
	double T1 = 600;

	ll D;
	cin >> D;

	vector<ll> cs(26);
	for (ll i = 0; i < 26; ++i) cin >> cs[i];

	vector<vector<ll>> ss(D, vector<ll>(26));
	for (ll i = 0; i < D; ++i) for (ll j = 0; j < 26; ++j) cin >> ss[i][j];

	vector<ll> ts = greedy_search(cs, ss);
	ll best_score = score(cs, ss, ts);

	ll T = T0;
	ll loop_count = 0;
	while (double(clock()) / CLOCKS_PER_SEC < TLE) {
		if (engine() % 2LL == 0LL) {
			ll d = engine() % D;
			ll t = engine() % 26LL;
			ll score = change(cs, ss, ts, best_score, d, t);
			if (update(best_score, score, T, engine)) {
				best_score = score;
				ts[d] = t;
			}
		}
		else {
			ll d1 = engine() % D;
			ll d2 = engine() % D;
			if (d1 == d2) continue;
			ll t1 = ts[d1];
			ll t2 = ts[d2];
			ll score = change(cs, ss, ts, best_score, d1, t2);
			ts[d1] = t2;
			score = change(cs, ss, ts, score, d2, t1);
			ts[d1] = t1;
			if (update(best_score, score, T, engine)) {
				best_score = score;
				ts[d1] = t2;
				ts[d2] = t1;
			}
		}

		++loop_count;
		if (loop_count % 100LL == 0) {
			double elapsed_time = double(clock()) / CLOCKS_PER_SEC / TLE;
			T = pow(T0, 1.0 - elapsed_time) * pow(T1, elapsed_time);
		}
	}

	// cout << "Score: " << score(cs, ss, ts) << endl;
	for (ll i = 0; i < D; ++i) {
		cout << ts[i] + 1LL << endl;
	}

	return 0;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;
}


Measured memory_bytes: 4344