#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

unsigned int randInt() {
	static unsigned int tx = 123456789, ty = 362436069, tz = 521288629, tw = 88675123;
	unsigned int tt = (tx ^ (tx << 11));
	tx = ty; ty = tz; tz = tw;
	return (tw = (tw ^ (tw >> 19)) ^ (tt ^ (tt >> 8)));
}
double randDouble() {
    return (double)(randInt())/UINT_MAX;
}
const int64_t CYCLES_PER_SEC=3000000000;
#define TIMES 1.0
double timeLimit=1.95*TIMES;
struct Timer {
	int64_t start;
	Timer() { reset(); }
	void reset() { start = getCycle(); }
	inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
	inline int64_t getCycle() {
		uint32_t low, high;
		__asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
		return ((int64_t)low) | ((int64_t)high << 32);
	}
} timer;
double temperature, p2;
int p3 = 15;
bool move(int prev_score, int next_score, double temperature) {
    if (prev_score <= next_score) return true;
    long long int diff = next_score - prev_score;
	//cerr << diff << " "<< pow(1.001, diff/temperature) << endl;
    //std::cerr << pow(1.0001, diff/temperature) << " " << randDouble() << std::endl;
    return pow(p2, diff/temperature) >= randDouble();
}
int D; 
int s[365][26];
int contest[365];
int c[26];
int last[366][26];
int score() {
	int S = 0;
	rep(i, 26) last[0][i] = -1;
	rep(i, D) {
		S += s[i][contest[i]];
		last[i][contest[i]] = i;
		rep(j, 26) {
			S -= c[j] * (i - last[i][j]);
			last[i + 1][j] = last[i][j];
		}
	}
	return S;
}

int diffscore(int d, int prev, int now) {
	int S = s[d][now] - s[d][prev];
	int d1 = d;
	//cerr << last[d1][prev] << " " << last[max(0, d1 - 1)][prev] << endl;
	//if(d == 0) cerr << "!" << endl;
	int day = last[max(0, d - 1)][prev];
	if(d == 0) day = -1;
	do {
		S += c[prev] * (d1 - last[d1][prev]);
		S -= c[prev] * (d1 - day);
		d1++;
	}while(d1 < D && last[d1][prev] != d1);
	d1 = d;
	do {
		S += c[now] * (d1 - last[d1][now]);
		S -= c[now] * (d1 - d);
		d1++;
	}while(d1 < D && last[d1][now] != d1);
	//cerr << endl;
	return S;
}

void change(int d, int prev, int now) {
	int day = last[max(0, d - 1)][prev];
	int d1 = d;
	if(d == 0) day = -1;
	do {
		//cerr << d << " " << last[d1][prev] << " " << day << endl;
		last[d1][prev] = day;
		d1++;
	}while(d1 < D && last[d1][prev] != d1);
	d1 = d;
	do {
		last[d1][now] = d;
		d1++;
	}while(d1 < D && last[d1][now] != d1);
}

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
	temperature =   12.638218400493681;
	p2 =   1.0100598775142506;
	//std::ifstream in(argv[3]);
    //std::cin.rdbuf(in.rdbuf());
	cin >> D;
	rep(i, 26) cin >> c[i];
	rep(i, 365) {
		rep(j, 26)  {
			cin >> s[i][j];
		}
	}
	rep(i, 365) {
		contest[i] = i % 26;
	}
	int now_score = score();
	//double temperature = 10.0;
	int cnt = 0;
	while(true) {
		double t=timer.get();
        if(t >= timeLimit) break;
		if(randInt() % 3 == 0) {
			int a = randInt() % 365;
			int b = randInt() % 26;
			while(b == contest[a]) {
				b = randInt() % 26;
			}
			int prev = contest[a];
			contest[a] = b;
			bool show = (randInt() % 100 == 0);
			int next_score = now_score + diffscore(a, prev, b);
			if(move(now_score, next_score, temperature)) {
				change(a, prev, b);
				now_score = next_score;
			} else {
				contest[a] = prev;
				
			}			
		} else {
			int a1 = randInt() % (365 - p3);
			int a2 = a1 + randInt() % (p3 - 1) + 1;
			int kind_a1 = contest[a1], kind_a2 = contest[a2];
			bool show = (randInt() % 100 == 0);
			int next_score = now_score;
			next_score += diffscore(a1, kind_a1, kind_a2);
			change(a1, contest[a1], contest[a2]);
			next_score += diffscore(a2, kind_a2, kind_a1);
			if(move(now_score, next_score, temperature)) {
				change(a2, kind_a2, kind_a1);
				swap(contest[a1], contest[a2]);
				now_score = next_score;
			} else {
				change(a1, kind_a2, kind_a1);
			}
					}
		temperature *= 0.9999997508091016;

		//cnt++;
	}
	//cerr << cnt << endl;
	cerr << now_score + 1000000 << endl;
	rep(i, D) {
		cout << contest[i] + 1 << endl;
    }
	
    return 0;
}


Measured memory_bytes: 3884