#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
#include <cassert>


using namespace std;
using namespace chrono;

//  https://ja.wikipedia.org/wiki/Xorshift
int xor64(void) 
{
	static unsigned long long x = 88172645463325252ULL;
	x ^= x << 13;
	x ^= x >> 7;
	x ^= x << 17;
	return int(x & 0x7fffffff);
}

const static int NUM_TYPE = 26;

int getFullScore(int D, const vector <int>& C, const vector <int>& T, const vector<vector<int>>& S)
{
	int sat = 0;

	vector <int> last(NUM_TYPE, 0);

	for (int d = 0; d < D; d++)
	{
		const int j = T[d];
		last[j] = d + 1;
		for (int i = 0; i < NUM_TYPE; i++)
		{
			sat -= (d + 1 - last[i]) * C[i];
		}
		sat += S[d][j];
	}

	return sat;
}

/*

int getContestScore(int day, int D, const vector <int>& C, const vector <int>& T, const vector<vector<int>>& S)
{
	int t = T[day];
	int score = S[day][t];

	int d0 = day;
	while (d0 >= 0 && T[d0] != t)
	{
		d0--;
	}
	int d1 = day;
	while (d1 < D && T[d1] != t)
	{
		d1++;
	}
	score += C[t] * (day - d0)*(d1 - day);

	return score;
}

int sum(int a, int b)
{
	int diff = abs(b - a) - 1;

	return diff * (diff + 1) / 2;
}

*/

int getDeltaScore(int day, int D, const vector <int>& C, const vector <int>& T, const vector<vector<int>>& S)
{
	int t = T[day];
	int ret = S[day][t];

	int prev = day - 1;
	while (prev >= 0 && T[prev] != t)
	{
		prev--;
	}

	int next = day + 1;
	while (next < D && T[next] != t)
	{
		next++;
	}

	ret += (next-day) * (day-prev) *C[t];

//	ret -= sum(prev, day) * C[T[day]];
//	ret -= sum(day, next) * C[T[day]];
//	ret += sum(prev, next) * C[T[day]];

	return ret;
}

// 提出時は標準入力から読み込み。練習中はファイルから読み込み
#ifdef SUBMISSION
#define	INPUT(a) cin >> (a);
#define	OUTPUT(a) cout << (a) << endl;
#else
#define	INPUT(a) fin >> (a);
#define	OUTPUT(a) fout << (a) << endl; // cerr << (a) << endl;
#endif

int main()
{
	//  入力
	int D;
	cin >> D;
	vector<int> C(26);
	for (int &c : C)
		cin >> c;
	vector<vector<int>> S(D, vector<int>(26));
	for (auto &s : S)
		for (auto &x : s)
			cin >> x;

	const static int NG = -1;

	auto start = system_clock::now();

	// T[d] d日目に開くコンテスト。T[d]=-1
	vector<int> T(D, -1);

	int score = 0;
	for (int t = 0; t < 26; t++)
	{
		score -= C[t] * D*(D + 1) / 2;
	}


	//  d日目にコンテストtを開く
	auto add = [&](int d, int t)
	{
		int d0 = d;
		while (d0 >= 0 && T[d0] != t)
		{
			d0--;
		}
		int d1 = d;
		while (d1 < D && T[d1] != t)
		{
			d1++;
		}
		score += C[t] * (d - d0)*(d1 - d);
		score += S[d][t];
		T[d] = t;
	};

	//  d日目のコンテストを止める
	auto remove = [&](int d)
	{
		int t = T[d];
		T[d] = -1;
		int d0 = d;
		while (d0 >= 0 && T[d0] != t)
		{
			d0--;
		}
		int d1 = d;
		while (d1 < D && T[d1] != t)
		{
			d1++;
		}
		score -= C[t] * (d - d0)*(d1 - d);
		score -= S[d][t];
	};

	for (int d = 0; d < D; d++)
	{
		add(d, d % 26);
	}

	int fullScore = getFullScore(D, C, T, S);

	assert(score == fullScore);



	double time = 0.0;
	double limit = 1.8;

	int step;
	for (step = 0; time < limit; step++)
	{
		if (step % 10000 == 0)
			time = duration_cast<microseconds>(system_clock::now() - start).count() * 1e-6;

		if (step % 2 == 0)
		{
			//  1日のコンテストの種類を変えてみる
			int d = xor64() % D;
			int t = xor64() % 26;

/*
			int old_t = T[d];
			int old_score = score;
			remove(d);
			add(d, t);

			//  悪くなったら戻す
			if (score < old_score)
			{
				remove(d);
				add(d, old_t);
			}
*/

//			int fullScore = getFullScore(D, C, T, S);
//			assert(score == fullScore);


 			const int currentContestScore = getDeltaScore(d, D, C, T, S);
//			const int currentContestScore2 = getContestScore(d, D, C, T, S);
//			assert(currentContestScore== currentContestScore2);




			int backupT = T[d];
			T[d] = t;
			const int nextContestScore = getDeltaScore(d, D, C, T, S);
			const int deltaScore = nextContestScore - currentContestScore;

			if (deltaScore>0)
			{
				score += deltaScore;
			}
			else
			{
				T[d] = backupT;
			}

//			fullScore = getFullScore(D, C, T, S);
//			assert(score == fullScore);
		}
		else
		{
			//  1週間以内のコンテストd0とd1を交換してみる
			int d0 = xor64() % D;
			int d1 = d0 + xor64() % 15 - 7;		// d1
			if (d1 != d0 && 0 <= d1 && d1 < D)
			{
				int deltaScore = 0;

				deltaScore -= getDeltaScore(d0, D, C, T, S);
				deltaScore -= getDeltaScore(d1, D, C, T, S);
				swap(T[d0], T[d1]);
				deltaScore += getDeltaScore(d0, D, C, T, S);
				deltaScore += getDeltaScore(d1, D, C, T, S);


				//  悪くなったら戻す
				//  ただし、ある程度までは許容する
				//  許容範囲は時間とともに狭める（焼きなまし）

				int boundaryScore = -int(10000 * (limit - time) / limit);

				if (deltaScore > boundaryScore)
				{
					score += deltaScore;
				}
				else
				{
					swap(T[d0], T[d1]);
				}
			}

//			int fullScore = getFullScore(D, C, T, S);
//			assert(score == fullScore);
		}
	}

	for (int t : T)
	{
		cout << t + 1 << endl;
	}

	cerr << "score: " << max(0, score + 1000000) << endl;
	cerr << "step: " << step << endl;
}


Measured memory_bytes: 3684