#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <tuple>
#include <utility>
#include <functional>
#include <sys/time.h>
#include <iomanip>

using namespace std;
using ll = long long;
#define REP(i, m, n) for(int i = (m); i < (n); ++i)
#define rep(i, n) REP(i, 0, n)
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr int MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr double EPS = 1e-11;

struct Xorshift {
	unsigned int x, y, z, w;
	
	Xorshift() {
		x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	}

	unsigned int rand(){
		unsigned int t = (x^(x<<11));
		x = y; y = z; z = w;
		return w = (w^(w>>19))^(t^(t>>8));
	}

	double rand_d(){
		return (double)rand() / (1LL << 32);
	}
};
Xorshift xor128;

constexpr int BEAM_SIZE = 1000;
constexpr int SZ = 26;
constexpr int D = 365;
array<int, SZ> C;
int SUM = 0;
array<array<int, SZ>, D> S;

struct beam_search {
	struct State {
		array<short, SZ> last = {};
		array<char, D> ans;
		int score = 0, sum = 0;

		void update_score(int d, int t) {
			score += S[d][t];
			sum -= C[t] * (d + 1 - last[t]);
			last[t] = d + 1;
			sum += SUM;
			score -= sum;
		}

		int next_eval(int d, int t){
			int res = score;
			res += S[d][t];
			res += C[t] * (d + 1 - last[t]);
			res -= sum + SUM;
			return res;
		}

		int eval() const {
			return score;
		}

		State place(int d, int t) {
			State res = *this;
			res.ans[d] = t;
			res.update_score(d, t);
			return res;
		}

		array<char, D> answer() {
			return ans;
		}
		
		bool operator<(const State &rhs) {
			return eval() < rhs.eval();
		}
	};

	
	array<char, D> solve() {
		State initial_state;
		using f = function<bool(State&, State&)>;
		priority_queue<State, vector<State>, f> cur([](State& a, State& b){return a.eval() > b.eval();});
		cur.push(initial_state);
		priority_queue<State, vector<State>, f> nxt([](State& a, State& b){return a.eval() > b.eval();});
		rep(d, D){
			while(!nxt.empty()) nxt.pop();
			while(!cur.empty()){
				State now = cur.top(); cur.pop();
				rep(t, SZ){
					if(nxt.size() < BEAM_SIZE || now.next_eval(d, t) > nxt.top().eval()) nxt.push(now.place(d, t));
					if(nxt.size() > BEAM_SIZE) nxt.pop();
				}
			}
			swap(cur, nxt);
		}

		State res;
		while(!cur.empty()){
			if(cur.size() == 1) res = cur.top();
			cur.pop();
		}
		cerr << res.eval() << endl;
		return res.answer();
	}
};

constexpr double T0 = 5e3, T1 = 1e2, TL = 1.98;

struct annealing {
	double temperature(double t){
		t /= TL;
		return pow(T0, 1.0 - t) * pow(T1, t);
	}

	int calc_score(array<char, D> ans){
		int res = 0, sum = 0;
		array<short, SZ> last = {};
		rep(d, D){
			char t = ans[d];
			res += S[d][t];
			sum -= C[t] * (d + 1 - last[t]);
			last[t] = d + 1;
			sum += SUM;
			res -= sum;
		}
		return res;
	}

	bool is_update(int diff_score, double temp){
		if (diff_score >= 0) return true;
		return exp((double)diff_score / temp) >= xor128.rand_d();
	}

	int solve(array<char, D> &ans) {
		int score = calc_score(ans);

		while((double)clock() / CLOCKS_PER_SEC < TL){
			double t = (double)clock() / CLOCKS_PER_SEC;
			double temp = temperature(t);
			rep(i, 100){
				if(xor128.rand() % 2){
					int d = xor128.rand() % D;
					char e = xor128.rand() % SZ;
					swap(ans[d], e);
					int new_score = calc_score(ans);
					if (!is_update(new_score - score, temp)) swap(ans[d], e);
					else score = new_score;
				}else{
					int d1 = xor128.rand() % (D - 1);
					int d2 = min((int)(d1 + 1 + xor128.rand() % 20), D - 1);
					swap(ans[d1], ans[d2]);
					int new_score = calc_score(ans);
					if (!is_update(new_score - score, temp)) swap(ans[d2], ans[d1]);
					else score = new_score;
				}
			}
		}

		return score;
	}
};

int main(void){
	int tmp;
	cin >> tmp;
	rep(i, SZ) cin >> C[i];
	rep(i, SZ) SUM += C[i];
	rep(i, D) rep(j, SZ) cin >> S[i][j];

	beam_search state1;
	auto ans = state1.solve();
	annealing state2;
	cerr << state2.solve(ans) << endl;
	for (char i : ans) cout << (int)i + 1 << endl;

	return 0;
}


Measured memory_bytes: 4464