/*
    IHC011: Simulated Annealing, SA

    山登り法2(112,357,759)、山登り法1(79,318,139)、貪欲法2(104,195,466)、貪欲法1(62,634,806) の続き

*/
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define SUBMIT 1

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#if !SUBMIT
const double TIME_LIMIT = 1.96 * 2.0;
const int64_t CYCLES_PER_SEC = 2000000000;	// for Local
//const int64_t CYCLES_PER_SEC = 2400000000;	// for server
#else
const double TIME_LIMIT = 1.96;
const int64_t CYCLES_PER_SEC = 2800000000;	// for SUBMIT
#endif

unsigned Rand(){ 
	static unsigned x=123456789;
	static unsigned y=362436069;
	static unsigned z=521288629;
	static unsigned w=88675123; 
	unsigned t=x^(x<<11);
	x=y; y=z; z=w;

	return w=(w^(w>>19))^(t^(t>>8));
}

struct Timer {
	int64_t start;
	int counter;
	double t;

	Timer() {
		reset();
	}

	void plus(double a){
		start -= a * CYCLES_PER_SEC;
	}

	int64_t getCycle() {
		uint32_t low, high;
		__asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
		return ((int64_t)low) | ((int64_t)high << 32);
	}

	void reset(){
		counter = 0;
		start = getCycle();
		t = 0.0;
	}

	double get(){
		return t = (double)(getCycle() - start) / CYCLES_PER_SEC;
	}
};

class IHC{
public:
	vector<int> solve(int _D, vector<int> _c, vector<vector<int>> _s){
		init(_D,_c,_s);

		out = geneRes();
		int score = calcScore(out);
		bestScore = score;
        int iter = 0;
        int restore = 0;

		double T0 = 2e3;
		double T1 = 6e2;
		double TL = TIME_LIMIT;

		double T = T0;

//		while((currentTime = timer.get()) < TIME_LIMIT){
		while(1){
			iter++;

			if (iter % 100 == 0){
				double t = timer.get() / TL;
				if (t >= 1.0){
					break;
				} // end if
				T = pow(T0, 1.0 - t) * pow(T1, t);
			} // en d if

            int r = Rand() % 2;
            if (r == 0){ // 1-point change
                int day = (Rand() % D) + 1;
                int post = Rand() % 26;
                int prev = out[day];
                int diff = diffScore(day, post);
                score += diff;
                if (accept((double)diff,T)){
                    cerr << "currentTime: " << timer.get() << " score: " << score << endl;
                    bestScore = score;
			    }else{ // restore
                    score -= diff;
                    out[day] = prev;
                    st[post].erase(day);
                    st[prev].insert(day);
                    restore++;
			    } // end if
            }else{ // 2-points swap
                int d1 = (Rand() % (D-2)) + 1;
                int d2 = min(D, d1 + (int)(Rand() % 16));
                int prev1 = out[d1];
                int prev2 = out[d2];
                int diff1 = diffScore(d1, prev2);
                int diff2 = diffScore(d2, prev1);
                score += diff1 + diff2;
                if (accept((double)(diff1 + diff2),T)){
                    cerr << "currentTime: " << timer.get() << " score: " << score << endl;
                    bestScore = score;
                }else{ // restore
                    score -= diff1 + diff2;
                    out[d1] = prev1;
                    out[d2] = prev2;
                    st[prev2].erase(d1);
                    st[prev1].insert(d1);
                    st[prev1].erase(d2);
                    st[prev2].insert(d2);                  
                }
            }
		} // end while
		cerr << "iter: " << iter << " ratio: " << (double)restore / (double)iter * 100.0 << " bestScore: " << bestScore << endl;

		return makeSolution(out);
	}
		
private:

	Timer timer;
	double startTime;
	double endTime;
	double currentTime;

	int D;
	vector<int> c;
	vector<vector<int>> s;
	vector<int> out;

	vector<int> last;
	set<int> st[26];
	vector<int> sat;

	int bestScore;

    double Log[32768];

    bool accept(double deltaScore, double T){
        if (deltaScore > -1e-9){
            return true;
        } //end if

        assert(deltaScore < 0.0);
        assert(T >= 0.0);

        if (deltaScore / T < -10.0){
            return false;
        } // end if

        if (Log[Rand() & 32767] < deltaScore / T){
            return true;
        } // end if

        return false;

    }

	int diffScore(int day, int post){
		int prev = out[day];
		st[prev].erase(day);

		auto itrp = st[prev].lower_bound(day);
		auto itrq = st[post].lower_bound(day);
		int rp = *itrp, rq = *itrq;
		itrp--;
		itrq--;
		int lp = *itrp, lq = *itrq;

		int diff = s[day-1][post] - s[day-1][prev];
		diff -= (day - lp) * (rp - day) * c[prev];
		diff += (day - lq) * (rq - day) * c[post];

        out[day] = post;
        st[post].insert(day);

		return diff;
	}

	int calcScore(vector<int> out){
		for (int d = 1; d <= D; d++){
			st[out[d]].insert(d);
			sat[d] = sat[d-1] + s[d-1][out[d]];
			last[out[d]] = d;
			rep (j, 26){
				sat[d] -= (d - last[j]) * c[j];
        	} // end rep
    	} // end for
        int res = sat[D];
//        cerr << "score: " << res << endl;
		return res;
	}

	vector<int> makeSolution(vector<int> out){
		vector<int> ret(D, 0);
		rep (i, D){
			ret[i] = out[i+1] + 1;
		} // end rep
		return ret;
	}

	vector<int> geneRes(void){
		vector<int> res(D+1, 0);
		for (int d = 1; d <= D; d++){
			res[d] = Rand() % 26;
		} // end rep
		return res;
	}

	void init(int _D, vector<int> _c, vector<vector<int>> _s){
		startTime = timer.get();
		endTime = TIME_LIMIT;
		D = _D;
		c = _c;
		s = _s;
		out.clear(); out.resize(D+1, 0);
		last.clear(); last.resize(26, 0);
		rep (i, 26){
			st[i].clear();
		} // end rep
		rep (i, 26){
			st[i].insert(0);
			st[i].insert(D+1);
    	} // end rep		
		sat.clear(); sat.resize(D + 1, 0);
        int sz = (int)sizeof(Log) / sizeof(Log[0]);
        rep (i, sz){
            Log[i] = log((i + 0.5) / (double)sz);
        } // end rep
	}
};

int main()
{
	IHC ihc;

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int D; cin >> D;
	vector<int> c(26, 0);
	rep (i, 26){
		cin >> c[i];
	} // end rep
	vector<vector<int>> s(D, vector<int>(26, 0));
	rep (i, D){
		rep (j, 26){
			cin >> s[i][j];
		} // end rep
	} // end rep

	vector<int> ret = ihc.solve(D,c,s);
	rep (i, (int)ret.size()){
		cout << ret[i] << endl;
	} // end rep

	return 0;
}


Measured memory_bytes: 5500