/*

Code for problem  by cookiedoth
Generated 28 Jun 2020 at 03.06 PM


   ,##.                   ,==.
 ,#    #.                 \ o ',
#        #     _     _     \    \
#        #    (_)   (_)    /    ; 
 `#    #'                 /   .'  
   `##'                   "=="

z_z
=_=
¯\_(ツ)_/¯

*/

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
#include <random>
#include <cstring>
#include <numeric>
#define ll long long
#define ld long double
#define null NULL
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define debug(a) cerr << #a << " = " << a << endl
#define forn(i, n) for (int i = 0; i < n; ++i)
#define sz(a) (int)a.size()

using namespace std;

template<class T> int chkmax(T &a, T b) {
	if (b > a) {
		a = b;
		return 1;
	}
	return 0;
}

template<class T> int chkmin(T &a, T b) {
	if (b < a) {
		a = b;
		return 1;
	}
	return 0;
}

template<class iterator> void output(iterator begin, iterator end, ostream& out = cerr) {
	while (begin != end) {
		out << (*begin) << " ";
		begin++;
	}
	out << endl;
}

template<class T> void output(T x, ostream& out = cerr) {
	output(x.begin(), x.end(), out);
}

void fast_io() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

const int K = 26;
const int MAX_D = 365;
int c[K], s[MAX_D][K];

struct solver {
	int D, sum;
	vector<set<int> > S;
	vector<int> a;

	int prog(int x, int len) {
		return len * (len - 1) / 2 * x;
	}

	solver() {}

	solver(int _D, vector<int> _a): D(_D), a(_a) {
		// cerr << "D = " << D << endl;
		S.resize(K);
		for (int i = 0; i < K; ++i) {
			S[i].insert(-1);
			S[i].insert(D);
		}
		sum = 0;
		for (int i = 0; i < D; ++i) {
			sum += s[i][a[i]];
			S[a[i]].insert(i);
		}
		for (int i = 0; i < K; ++i) {
			auto it = next(S[i].begin());
			while (it != S[i].end()) {
				// cerr << "subt prog " << c[i] << " " << (*it) - (*prev(it)) << endl;
				sum -= prog(c[i], (*it) - (*prev(it)));
				it++;
			}
		}
		// cerr << "sum = " << sum << endl;
	}

	void find_nb(int clr, int x, int &l, int &r) {
		auto it = S[clr].upper_bound(x);
		auto it2 = S[clr].lower_bound(x);
		r = (it == S[clr].end() ? -1 : (*it));
		l = (it2 == S[clr].begin() ? -1 : (*prev(it2)));
	}

	int modify(int pos, int val) {
		// cerr << "modify " << pos << " " << val << endl;
		if (a[pos] == val) {
			return 0;
		}
		int old_val = a[pos];
		int res = 0, l, r;
		find_nb(val, pos, l, r);
		res -= prog(c[val], pos - l);
		res -= prog(c[val], r - pos);
		res += prog(c[val], r - l);
		// cerr << "lr for " << val << " " << pos << " = " << l << " " << r << endl;
		find_nb(old_val, pos, l, r);
		res += prog(c[old_val], pos - l);
		res += prog(c[old_val], r - pos);
		res -= prog(c[old_val], r - l);
		// cerr << "lr for " << old_val << " " << pos << " = " << l << " " << r << endl;
		// cerr << "res = " << res << endl;
		res -= s[pos][old_val];
		res += s[pos][val];
		// cerr << "done" << endl;
		// cerr << "delta = " << res << endl;
		return res;
	}

	void apply_modification(int pos, int val, int delta) {
		sum += delta;
		int old_val = a[pos];
		S[old_val].erase(pos);
		S[val].insert(pos);
		a[pos] = val;
	}
};

int D;

void read() {
	cin >> D;
	for (int i = 0; i < K; ++i) {
		cin >> c[i];
	}
	for (int i = 0; i < D; ++i) {
		for (int j = 0; j < K; ++j) {
			cin >> s[i][j];
		}
	}
}

vector<int> t;

void read_t() {
	t.resize(D);
	for (int i = 0; i < D; ++i) {
		cin >> t[i];
		t[i]--;
	}
}

int lst[K];

void solveB() {
	fill(lst, lst + K, -1);
	int sat = 0;
	for (int i = 0; i < D; ++i) {
		sat += s[i][t[i]];
		lst[t[i]] = i;
		for (int j = 0; j < K; ++j) {
			sat -= c[j] * (i - lst[j]);
		}
		cout << sat << "\n";
	}
}

solver S;

void solveC() {
	S = solver(D, t);
	int m;
	cin >> m;
	for (int it = 0; it < m; ++it) {
		int pos, val;
		cin >> pos >> val;
		pos--;
		val--;
		int delta = S.modify(pos, val);
		S.apply_modification(pos, val, delta);
		cout << S.sum << '\n';
	}
}

const int INF = 1e9;

void find_t_greedily() {
	t.resize(D);
	fill(lst, lst + K, -1);
	for (int i = 0; i < D; ++i) {
		// cerr << "i = " << i << endl;
		int best = -INF, opt = -1;
		for (int x = 0; x < K; ++x) {
			int cur = s[i][x] + c[x] * (i - lst[x]);
			if (chkmax(best, cur)) {
				opt = x;
			}
		}
		t[i] = opt;
		lst[opt] = i;
	}
}

void print_cf() {
	solver S(D, t);
	cerr << S.sum << endl;
}

ld t0 = clock();

ld apple_watch() {
	return ((ld)clock() - t0) / CLOCKS_PER_SEC;
}

mt19937 rng(58);

const int MASK = (1 << 9);

ld real() {
	return (ld)rng() / (ld)rng.max();
}

const ld maxQ = 4e9;

void local_optimizations() {
	solver S(D, t);
	cerr << S.sum << endl;
	int iter = 0;
	while (true) {
		iter++;
		int pos = rng() % D;
		int clr = rng() % K;
		int delta = S.modify(pos, clr);
		ld Q = (maxQ / (ld)iter);
		if (delta >= 0) {
			S.apply_modification(pos, clr, delta);
		} else {
			ld p = exp(-(ld)abs(delta) / (ld)Q);
			if (real() < p) {
				S.apply_modification(pos, clr, delta);
			}
		}
		if (!(iter & MASK) && apple_watch() > 1.98) {
			break;
		}
	}
	cerr << "Iterations performed: " << iter << endl;
	t = S.a;
	cerr << S.sum << endl;
}

void print_ans() {
	for (int i = 0; i < D; ++i) {
		cout << t[i] + 1 << '\n';
	}
}

signed main() {
	fast_io();
	read();
	find_t_greedily();
	local_optimizations();
	print_ans();
}


Measured memory_bytes: 3792