#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <cassert>
#include <chrono>
#include <fstream>
#include <array>
using ll = long long;

//LLONG_MAX
//#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

#ifdef LOCAL
#define ASSERT_DEBUG
#endif
#ifdef ASSERT_DEBUG
#define ASSERT(cond) assert(cond)
#else
#define ASSERT(cond)
#endif

class Point
{
public:
	int x;
	int y;
	Point() { this->x = 0; this->y = 0; }
	Point(int x, int y) { this->x = x; this->y = y; }
};

//time_point<system_clock> _start_time = system_clock::now();
//ll time = duration_cast<milliseconds>(system_clock::now() - _start_time).count();


//const int R = 10000;
//const double START_TEMP = pow(50.0, 2);
//const double END_TEMP = 0;
//double temp = sqrt(START_TEMP + (END_TEMP - START_TEMP) * (ms / (double)1900));
//double probability = MIN(1.0, exp((score - new_score) / temp));
//bool force_next = probability > ((xorshift32() % R) / (double)R);
//if (force_next)

using namespace std;
using namespace chrono;

unsigned int xorshift32()
{
	static int s = 7;
	s ^= (s << 13);
	s ^= (s >> 17);
	s ^= (s << 15);
	return s;
}


const int D = 365;
const int N = 26;
int C[N];
int S[N][D];

list<int> _list[N];
int rui[D + 1];

int GetScore(int schedule[D])
{
	int score = 0;
	int last[N] = {};
	for (int d = 0; d < D; d++)
	{
		score += S[schedule[d]][d];
		last[schedule[d]] = (d + 1);
		for (int n = 0; n < 26; n++)
		{
			score -= C[n] * ((d + 1) - last[n]);
		}
	}
	return score;
}



int Change(int schedule[D], int prev_score, int d, int new_n)
{
	int old_n = schedule[d];
	int score = prev_score;
	int day = d + 1;

	int old_prev_day;
	int old_next_day;
	for (auto it = _list[old_n].begin(); it != _list[old_n].end(); ++it)
	{
		if (*it == day)
		{
			auto next = _list[old_n].erase(it);
			old_next_day = *next;
			break;
		}
		old_prev_day = *it;
	}

	int new_prev_day;
	int new_next_day;
	for (auto it = _list[new_n].begin(); it != _list[new_n].end(); ++it)
	{
		if (*it > day)
		{
			_list[new_n].insert(it, day);
			new_next_day = *it;
			break;
		}
		new_prev_day = *it;
	}

	schedule[d] = new_n;

	int socre = prev_score;
	score -= S[old_n][d];
	score += C[old_n] * rui[(day - old_prev_day) - 1];
	score += C[old_n] * rui[(old_next_day - day) - 1];
	score -= C[old_n] * rui[(old_next_day - old_prev_day) - 1];

	score += S[new_n][d];
	score -= C[new_n] * rui[(day - new_prev_day) - 1];
	score -= C[new_n] * rui[(new_next_day - day) - 1];
	score += C[new_n] * rui[(new_next_day - new_prev_day) - 1];

	return score;
}




int main()
{
	int _;
	cin >> _;
	REP(n, N)
	{
		cin >> C[n];
	}
	REP(d, D)
	{
		REP(n, N)
		{
			cin >> S[n][d];
		}
	}

	int cur = 0;
	for (int i = 0; i <= D; i++)
	{
		cur += i;
		rui[i] = cur;
	}

	int schedule[D] = {};
	int best_schedule[D] = {};
	for (int i = 0; i <= D + 1; i++)
	{
		_list[0].push_back(i);
	}
	for (int i = 1; i < N; i++)
	{
		_list[i].push_back(0);
		_list[i].push_back(D + 1);
	}

	//int raw_score1 = GetScore(schedule);
	//cerr << raw_score1 << endl;
	//cerr << endl;
	//int new_score;
	//int raw_score = raw_score1;

	//new_score = Change(schedule, raw_score, 364, 10);
	//raw_score = GetScore(schedule);
	//cerr << new_score << endl;
	//cerr << raw_score << endl;
	//new_score = Change(schedule, raw_score, 0, 0);
	//raw_score = GetScore(schedule);
	//cerr << new_score << endl;
	//cerr << raw_score << endl;
	//new_score = Change(schedule, raw_score, 30, 20);
	//raw_score = GetScore(schedule);
	//cerr << new_score << endl;
	//cerr << raw_score << endl;
	//new_score = Change(schedule, raw_score, 30, 0);
	//raw_score = GetScore(schedule);
	//cerr << new_score << endl;
	//cerr << raw_score << endl;

	time_point<system_clock> _start_time = system_clock::now();
	int prev_score = GetScore(schedule);
	int best_score = prev_score;
	int loop = 0;
	const int TIME_LIMIT = 1980;
	while (true)
	{
		loop++;
		ll time = duration_cast<milliseconds>(system_clock::now() - _start_time).count();
		if (time > TIME_LIMIT)
		{
			break;
		}

		int rnd = xorshift32() % 30;
		if (rnd == 0)
		{
			int d = xorshift32() % (D - 1);
			int prev_n1 = schedule[d];
			int prev_n2 = schedule[d + 1];

			int new_score = Change(schedule, prev_score, d + 1, prev_n1);
			new_score = Change(schedule, new_score, d, prev_n2);

			const int R = 1000000000;
			const double START_TEMP = 10000000.0;
			const double END_TEMP = 0;
			double temp = sqrt(START_TEMP + (END_TEMP - START_TEMP) * (time / (double)TIME_LIMIT));
			double probability = min(1.0, exp((new_score - prev_score) / temp));
			bool force_next = probability > ((xorshift32() % R) / (double)R);

			if (force_next)
			{
				if (best_score < new_score)
				{
					best_score = new_score;
					memcpy(best_schedule, schedule, sizeof(best_schedule));
#if LOCAL
					//cerr << time << ":" << loop << ":" << new_score << endl;
#endif
				}

				prev_score = new_score;
			}
			else
			{
				Change(schedule, prev_score, d, prev_n1);
				Change(schedule, prev_score, d + 1, prev_n2);
			}
		}
		else
		{
			int d = xorshift32() % D;
			int n = xorshift32() % N;
			int prev_n = schedule[d];

			int new_score = Change(schedule, prev_score, d, n);
			const int R = 1000000000;
			const double START_TEMP = 10000000.0;
			const double END_TEMP = 0;
			double temp = sqrt(START_TEMP + (END_TEMP - START_TEMP) * (time / (double)TIME_LIMIT));
			double probability = min(1.0, exp((new_score - prev_score) / temp));
			bool force_next = probability > ((xorshift32() % R) / (double)R);

			if (force_next)
			{
				if (best_score < new_score)
				{
					best_score = new_score;
					memcpy(best_schedule, schedule, sizeof(best_schedule));
#if LOCAL
					//cerr << time << ":" << loop << ":" << new_score << endl;
#endif
				}

				prev_score = new_score;
			}
			else
			{
				Change(schedule, new_score, d, prev_n);
			}
		}
	}

	int score = GetScore(best_schedule);
	cerr << "loop  : " << loop << endl;
	cerr << "score : " << score << endl;



	REP(i, D)
	{
		cout << (best_schedule[i] + 1) << endl;
	}
}

Measured memory_bytes: 3860