#ifndef TIMER_H
#define TIMER_H

#include <cstdint>

#ifdef ONLY_MY_ENVIR

#include <chrono>
class Timer {
	const std::chrono::time_point<std::chrono::system_clock> start;
	int64_t limit_microsec = 0;

public:
	Timer();
	void set(int64_t time_microsec);
	bool elapsed() const;
	int64_t getMicrosec() const;
};

#else

class Timer {
	static const uint64_t ClocksPerMicrosec;
	const uint64_t start_clocks;
	uint64_t limit_clocks;

	uint64_t getClocks() const;
public:
	Timer();
	void set(int64_t time_microsec);
	bool elapsed() const;
	int64_t getMicrosec() const;
};

#endif

#endif

#ifdef ONLY_MY_ENVIR
#include "Timer.h"
#endif

#ifdef ONLY_MY_ENVIR

using namespace std::chrono;

Timer::Timer()
	: start(system_clock::now()) {
}

void Timer::set(int64_t time_microsec) {
	limit_microsec += time_microsec;
}

bool Timer::elapsed() const {
	return getMicrosec() >= limit_microsec;
}

int64_t Timer::getMicrosec() const {
	return duration_cast<microseconds>(system_clock::now() - start).count();
}

#else

const uint64_t Timer::ClocksPerMicrosec = 2987;

uint64_t Timer::getClocks() const {
	unsigned int lo, hi;
	__asm__ volatile ("rdtsc" : "=a" (lo), "=d" (hi));
	return ((uint64_t)hi << 32) | lo;
}

Timer::Timer() 
	: start_clocks(getClocks()), limit_clocks(start_clocks) {
}

void Timer::set(int64_t time_microsec) {
	limit_clocks += time_microsec * ClocksPerMicrosec;
}

bool Timer::elapsed() const {
	return getClocks() >= limit_clocks;
}

int64_t Timer::getMicrosec() const {
	return (getClocks() - start_clocks) / ClocksPerMicrosec;
}

#endif

#ifndef RANDOM_H
#define RANDOM_H

#include <cstdint>
#include <utility>

uint32_t rnd();
uint32_t rnd(uint32_t max);

template <class T>
void shuffle(T& arr);

template <class T>
void shuffle(T& arr) {
	for (int i = arr.size(); i > 1; --i) {
		std::swap(arr[i - 1], arr[rnd(i)]);
	}
}

#endif

#ifdef ONLY_MY_ENVIR
#include "Random.h"
#endif

#include <vector>

uint32_t rnd() {
	static uint32_t val = 3141592653ul;
	val ^= val << 13;
	val ^= val >> 17;
	val ^= val << 15;
	return val;
}

uint32_t rnd(uint32_t max) {
	return rnd() % max;
}

#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>

using namespace std;
using uint = uint32_t;
using LL = int64_t;
using ULL = uint64_t;
using PP = pair<LL, LL>;
template <typename T> using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
#define REP(i, a, n) for(LL i = (a), i##_max_ = (n); i < i##_max_; ++i)
#define REM(i, a, n) for(LL i = (LL)(n) - 1, i##_min_ = (a); i >= i##_min_; --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP { cin.tie(NULL); ios::sync_with_stdio(false); }
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U> istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U> ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N> void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N> void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template <class T> T Next() { T buf; cin >> buf; return buf; }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }

#ifdef ONLY_MY_ENVIR
#include "Accumulator.h"
#include "Algebraic.h"
#include "BinaryMatrix.h"
#include "BinaryTree.h"
#include "Bipartite.h"
#include "BIT.h"
#include "Compressor.h"
#include "Decompositions.h"
#include "DiscreteLog.h"
#include "DynamicMod.h"
#include "Factorization.h"
#include "FFT.h"
#include "FlowSolver.h"
#include "Graph.h"
#include "GraphUtil.h"
#include "IntMod.h"
#include "LazySegmentTree.h"
#include "LIS.h"
#include "Math.h"
#include "MathUtil.h"
#include "Matrix.h"
#include "MinCostFlowSolver.h"
#include "MinMax.h"
#include "Numbers.h"
#include "Optimize.h"
#include "Permutation.h"
#include "Polynomial.h"
#include "Position.h"
#include "Random.h"
#include "Range.h"
#include "Rational.h"
#include "RuntimeMod.h"
#include "SegmentTree.h"
#include "SegmentTree2D.h"
#include "Sets.h"
#include "Shortest.h"
#include "SlidingWindow.h"
#include "SpanningTree.h"
#include "StringSearching.h"
#include "SuffixArray.h"
#include "SwitchList.h"
#include "Timer.h"
#include "Tree.h"
#include "TreeUtil.h"
#include "UnionFind.h"
#include "Util.h"
#include "VectorUtil.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>>(istream& ist, __int128& val) { LL tmp; ist >> tmp; val = tmp; return ist; }
ostream& operator<<(ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

const int K = 26;
const int N = 365;
LL C[K];
LL S[N][K];

class Helper {
	int state[N];
	LL score;
	LL prev_score;

	//int memo_type;
	int memo_i;
	int memo_k;

public:
	Helper() {
		REP(i, 0, N) state[i] = i % 26;
		score = calcScore();
	}
	
	//void changeSwap(int i, int j) {

	//}

	void change(int i, int k) {
		state[i] = k;
	}

	LL step() {
		prev_score = score;

		//if (rnd(2)) {
		//	int i = rnd(N - 1);
		//	changeSwap(i, i + 1);
		//} else {
			int i = rnd(N);
			int k = rnd(K);
			memo_i = i;
			memo_k = state[i];
			change(i, k);
		//}

		score = calcScore();
		return score - prev_score;
	}

	void undo() {
		change(memo_i, memo_k);
		score = prev_score;
	}

	const int* getState() const {
		return state;
	}

	LL getScore() const {
		return score;
	}

	LL calcScore() const {
		LL good = 0;
		REP(i, 0, N) {
			good += S[i][state[i]];
		}

		LL bad = 0;
		LL last[K];
		fill(last, last + K, -1);
		REP(i, 0, N) {
			last[state[i]] = i;
			REP(k, 0, K) {
				bad += C[k] * (i - last[k]);
			}
		}
		return good - bad;
	}
};

int main() {
#ifdef ONLY_MY_ENVIR
	ifstream ifs("sample.txt");
	ifs >> Ignore;
	REP(k, 0, K) ifs >> C[k];
	REP(i, 0, N) REP(k, 0, K) ifs >> S[i][k];
#else
	cin >> Ignore;
	REP(k, 0, K) cin >> C[k];
	REP(i, 0, N) REP(k, 0, K) cin >> S[i][k];
#endif

	Helper helper;
	const double tmp_start = 1e7;
	const double tmp_finish = 1e0;
	double tmp = tmp_start;

	const int time = 1990000;
	Timer timer;
	timer.set(time);

	int z = 0;
	while (z % 256 == 0 || !timer.elapsed()) {
		++z;
		if (z % 256 == 0) {
			double ratio = (double)timer.getMicrosec() / time;
			tmp = tmp_start * std::pow(tmp_finish / tmp_start, ratio);
			cerr << tmp << ' ' << helper.getScore() << endl;
		}

		LL delta = helper.step();
		bool accepted = delta >= 0 || -delta <= 8 * tmp && rnd() < std::exp(delta / tmp) * (1ll << 32);

		if (!accepted) {
			helper.undo();
		}
	}

	auto state = helper.getState();

#ifdef ONLY_MY_ENVIR
	ofstream ofs("out.txt");
	REP(i, 0, N) {
		ofs << state[i] + 1 << endl;
	}
#else
	REP(i, 0, N) {
		cout << state[i] + 1 << endl;
	}
#endif	
	return 0;
}



Measured memory_bytes: 4456