#include <bits/stdc++.h>

using namespace std;
using lli = int_fast64_t;
using ulli = unsigned long long;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = copy(x);cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;

constexpr lli plusScore = (lli)1e6;
constexpr lli D = 365;
constexpr lli asize = 26;
constexpr lli maximumNone = 40;
constexpr lli minimumNone = 5;

array<lli, asize> C;
array<lli, asize> Cnum;

array<array<lli, asize>, D> S;
array<array<lli, asize>, D> Snum;
array<bool, D> needChange;

lli calcScore(const vector<lli>& t) {
	vector<lli> last_open(asize, -1);
	lli score = 0;
	for (int i = 0; i < D; i++) {
		score += S[i][t[i]];
		//if (last_open[t[i]] != -1 && (i - last_open[t[i]]) < minimumNone) {
		//	needChange[i] = true;
		//}
		last_open[t[i]] = i;
		for (int j = 0; j < asize; j++) {
			score -= C[j] * (i - last_open[j]);
		}
		//cout << score << "\n";
	}

	return score;
};

int main() {
	chrono::high_resolution_clock::time_point start = chrono::high_resolution_clock::now();

	std::random_device seed_gen;
	std::mt19937 engine(seed_gen());

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

	


#ifdef MY_MSVC_DEBUG
	{
		ifstream ifs("sample2.in");
		ifs >> devNull;
		for (lli& i : C)ifs >> i;
		for (auto& arr : S) {
			for (lli& i : arr) {
				ifs >> i;
			}
		}
		ifs.close();
	}

#else

	{
		cin >> devNull;
		for (lli& i : C)cin >> i;
		for (auto& arr : S) {
			for (lli& i : arr) {
				cin >> i;
		}
	}
}
#endif
	for (bool& b : needChange)b = false;
	iota(Cnum.begin(), Cnum.end(), 0);
	sort(Cnum.begin(), Cnum.end(), [&](lli l, lli r) {
		return C[l] < C[r];
	});


	for (lli i = 0; i < D; i++) {
		iota(Snum[i].begin(), Snum[i].end(), 0);
		sort(Snum[i].begin(), Snum[i].end(), [&](lli l, lli r) {
			return S[i][l] < S[i][r];
		});
	}

	std::vector<double> probabilities(asize);
	for (lli i = 0; i < asize; i++) {
		probabilities[i] = log(C[Cnum[asize-i-1]]+5);
	}
	std::discrete_distribution<std::size_t> dist(
		probabilities.begin(),
		probabilities.end()
	);

	vector<lli> T(D);
	vector<lli> linh(asize);
	iota(linh.begin(), linh.end(), 0);
	for (int i = 0; i < D; i++) {
		if (i % asize == 0)shuffle(linh.begin(), linh.end(), engine);
		T[i] = linh[i % asize];
	}

	lli beforescore = calcScore(T);
	lli cnt = 0;

	while (chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now().time_since_epoch() - start.time_since_epoch()) < chrono::duration_cast<chrono::milliseconds>(1970ms)) {
		lli changeday = engine() % D;
		lli i = Cnum[dist(engine)];
		//lli i =engine()%asize;
		vector<lli> tt = T;
		tt[changeday] = i;
		if (lli ts = calcScore(tt); beforescore < ts) {
			T[changeday] = i;
			beforescore = ts;
		}
		cnt++;
	}



	for (lli i : T) {
		cout << i + 1 << "\n";
	}
	debug(beforescore + plusScore);
	cout << flush;
	//debugv(probabilities);
	return 0;
}



Measured memory_bytes: 3964