#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int  INF = (1 << 30) - 1;
const ll INFL = 1LL << 60;
const ll mod = 10000000007;


std::chrono::system_clock::time_point start;
std::chrono::system_clock::time_point owari;

double calc_time() {
	owari = std::chrono::system_clock::now();
	return std::chrono::duration_cast<std::chrono::milliseconds>(owari - start).count();
}

/*
inline unsigned long long xor128() {
	static unsigned long long rx = 411111789, ry = 9471111169, rz = 5212488629, rw = 886575123;
	unsigned long long rt = (rx ^ (rx << 11));
	rx = ry;
	ry = rz;
	rz = rw;
	return (rw = (rw ^ (rw >> 19)) ^ (rt ^ (rt >> 8)));
}
*/
inline uint32_t xor128() {

	static uint32_t seed = 2;
	seed = seed ^ (seed << 7);
	seed = seed ^ (seed >> 12);
	return seed = seed & (~1);
}

double rand128() {
	return (double)(xor128() & 0xFFFF) / 0xFFFF;
}

int D;

set<int> a[26];
int pena[26];
int s[365][26];
int ans[365];
int pe[26];
int score = 0;

void calc(int b, int c, int diff) {

	int cur = 0;

	set<int> t = a[c];
	t.insert(b + 1);
	int tmp = 0;
	for (int i : t) {
		int j = i - tmp;
		j--;
		cur += j * (j + 1) / 2;
		tmp = i;
	}
	cur *= pena[c];

	diff += pe[c];
	diff -= cur;

	tmp = 0;

	int cur2 = 0;

	for (int i : a[ans[b]]) {
		if (i == b + 1)continue;
		int j = i - tmp;
		j--;
		cur2 += j * (j + 1) / 2;
		tmp = i;
	}

	cur2 *= pena[ans[b]];

	diff += pe[ans[b]];
	diff -= cur2;
	//cerr << diff << endl;
	if (diff > 0) {
		a[ans[b]].erase(b + 1);
		a[c].insert(b + 1);
		pe[c] = cur;
		pe[ans[b]] = cur2;
		ans[b] = c;
		score += diff;
	}
}


int main() {


	start = std::chrono::system_clock::now();
	cin >> D;

	REP(i, 26)cin >> pena[i];
	REP(i, 365)REP(j, 26) {
		cin >> s[i][j];
	}

	REP(i, 26)a[i].insert(0);
	REP(i, 26)a[i].insert(366);


	REP(i, D) {
		ans[i] = i % 26;
		a[i % 26].insert(i + 1);
		score += s[i][i % 26];
	}
	int loop = 0;

	REP(i, 26) {
		int tmp = 0;
		int cc = 0;
		for (int j : a[i]) {
			int k = j - tmp;
			k--;
			score -= (k*(k + 1)) / 2 * pena[i];
			cc += (k*(k + 1)) / 2 * pena[i];
			tmp = j;
		}
		pe[i] = cc;
	}

	
	while (true) {
		loop++;
		//if (loop == 100)break;
		if (loop & 127) {
			if (calc_time() > 1900)break;
		}

		int b = xor128() % 365;
		int c = xor128() % 26;
		if (ans[b] == c)continue;
		int diff = s[b][c] - s[b][ans[b]];
		calc(b, c, diff);
		//cerr << diff << endl;
		/*
		if (diff > 0) {
			a[ans[b]].erase(b + 1);
			a[c].insert(b + 1);
			ans[b] = c;
			score += diff;
		}*/
	}
	
	REP(i, 365) {
		cout << ans[i] + 1 << endl;
	}

	cerr << score << endl << loop << endl;

}

Measured memory_bytes: 3688