#include <bits/stdc++.h>
#include <sys/time.h>
#pragma GCC optimize "O3,omit-frame-pointer,inline"
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

constexpr ll CYCLES_PER_SEC = 2800000000;
constexpr double TL = 1900;

const int D = 365;
int c[26];
int s[365][26];

double get_ms() { struct timeval t; gettimeofday(&t, NULL); return (double)t.tv_sec * 1000 + (double)t.tv_usec / 1000; }

const int MAX_LOOP = 1000;
const int BEAM_WIDTH = 1;

uint32_t XorShift(void) {
	static uint32_t x = 123456789;
	static uint32_t y = 362436069;
	static uint32_t z = 521288629;
	static uint32_t w = 88675123;
	uint32_t t;

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

double Prob(void){
	double ret = (double)XorShift() / UINT_MAX;
	return ret;
}

class State{
public:
	State() : score(0){
        contest.resize(365);
        day.resize(26);
        REP(i,26) day[i].insert(0), day[i].insert(D+1);
	}

    ll score;
    // d日目のコンテスト
    vector<int> contest;
    // 各コンテストが行われた日
    vector<set<int>> day;

	bool operator < (const State& state) const {
        return score < state.score;
	}
};


namespace A{

	State initialState;
	State bestState;
	double start = 0.0;

	void input(){
		int d; cin >> d;
		start = get_ms();
        REP(i,26) cin >> c[i];
        REP(i,D) REP(j,26) cin >> s[i][j];

        REP(i,D){
            // int x;
            // cin >> x;
            // x--;
            int x = XorShift() % 26;
            initialState.contest[i] = x;
            initialState.day[x].insert(i+1);
            initialState.score += s[i][x];
            // cerr << x << " " << s[i][x] << endl;
            REP(j,26){
                if(j == x) continue;
                auto itr = initialState.day[j].upper_bound(i+1);
                itr--;
                int last = *itr;
                // cout << j << " " << last << endl;
                initialState.score -= c[j] * (i + 1 - last);
            }
            // cout << initialState.score << endl;
        }
		bestState = initialState;
        // cerr << bestState.score << endl;
	}

	void output(){
		REP(i,D) cout << bestState.contest[i] + 1 << endl;
        cerr << "bestState score : " << bestState.score << endl;
	}

    // d日目をコンテストxに変更した時の差分計算
    void subCalc(State &state, int d, int x){
        int pre = state.contest[d];
        state.day[x].insert(d+1);
        auto itr = state.day[x].lower_bound(d+1);
        auto itr2 = itr;
        itr--;
        itr2++;
        if(*itr2 == D+1){
            ll a = *itr;
            ll l = 365;

            ll dd = (l - a - 1) * (a + l) / 2;
            state.score += (dd - (l - a - 1) * a) * c[x];
            state.score += s[d][x];

            dd = (d - a - 1) * (a + 1 + d - 1) / 2;
            state.score -= (dd - (d - a - 1) * a) * c[x];
            dd = (l - d - 1) * (d + 1 + l - 1) / 2;
            state.score -= (dd - (l - d - 1) * d) * c[x];
        }
        else{
            ll a = *itr;
            ll l = *itr2;

            ll dd = (l - a - 1) * (a + l) / 2;
            state.score += (dd - (l - a - 1) * a) * c[x];
            state.score += s[d][x];
            dd = (d - a - 1) * (a + 1 + d - 1) / 2;
            state.score -= (dd - (d - a - 1) * a) * c[x];
            dd = (l - d - 1) * (d + 1 + l - 1) / 2;
            state.score -= (dd - (l - d - 1) * d) * c[x];
        }

        itr = state.day[pre].lower_bound(d + 1);
        itr2 = itr;
        itr--;
        itr2++;
        
        if(*itr2 == D+1){
            ll a = *itr;
            ll l = 365;
            ll dd = (l - a - 1) * (a + l) / 2;
            state.score -= (dd - (l - a - 1) * a) * c[pre];
            state.score -= s[d][pre];
            dd = (d - a - 1) * (a + 1 + d - 1) / 2;
            state.score += (dd - (d - a - 1) * a) * c[pre];
            dd = (l - d - 1) * (d + 1 + l - 1) / 2;
            state.score += (dd - (l - d - 1) * d) * c[pre];
        }
        else{
            ll a = *itr;
            ll l = *itr2;

            ll dd = (l - a - 1) * (a + l) / 2;
            state.score -= (dd - (l - a - 1) * a) * c[pre];
            state.score -= s[d][pre];
            dd = (d - a - 1) * (a + 1 + d - 1) / 2;
            state.score += (dd - (d - a - 1) * a) * c[pre];
            dd = (l - d - 1) * (d + 1 + l - 1) / 2;
            state.score += (dd - (l - d - 1) * d) * c[pre];
        }
    }

    void Calc(State &state, int d, int x){
        REP(i,D){
            int con = 0;
            if(i == d) con = x;
            else con = bestState.contest[i];

            state.contest[i] = con;
            state.day[con].insert(i+1);
            
            state.score += s[i][con];
            REP(j,26){
                if(j == con) continue;
                auto itr = state.day[j].upper_bound(i+1);
                itr--;
                int last = *itr;
                // cout << j << " " << last << endl;
                state.score -= c[j] * (i + 1 - last);
            }
        }
    }

    void simulate(){
		int cnt = 0;
        double C = TL * 100; //許容する確率定数
        while(1){
            auto end = get_ms();
            // cerr << "now : " << end - start << endl;
            if(end - start >= TL) break;

            int d = XorShift() % 365;
            int x = XorShift() % 26;
            if(bestState.contest[d] == x) continue;

			State nextState = bestState;
            subCalc(nextState, d, x);
            // State nextState;
            // Calc(nextState, d, x);
            // cerr << bestState.score << " " << nextState.score << endl;
            // cerr << "now : " << end - start << endl;
			auto rest_time = TL - end;
			double next = rest_time / C;

			if(bestState.score < nextState.score || next > Prob()){
				bestState = nextState;
			}
			else{
				continue;
			}
            cnt++;
        }
        cerr << "cnt : " << cnt << endl;
	}

	void main(){
		input();
        simulate();
		output();
		// test();
	}
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
	A::main();
    
}

Measured memory_bytes: 4040