#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
#include <random>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
// #define INF 1LL<<60

const int INF = 1e9;
int D;

int calc_score(vector<int>& t, vector< vector<int> >& s, vector<int>& c) {
    vector<int> last(26, 0);
    int ans = 0;
    int day_worst = 0, worst_score = 0;
    FOR(d, 1, D) {
        int update = 0;
        update += s[d-1][t[d-1] - 1];
        last[t[d-1] - 1] = d;
        REP(i, 26) {
            update -= c[i] * (d - last[i]);
        }
        if(worst_score > update) {
            worst_score = update;
            day_worst = d;
        }
        ans += update;
    }
    return ans;
}

double sigmoid(double x) {
    return 1.0 / (1.0 + exp(-x));
}

int calc_score_with_report(vector<int>& t, vector< vector<int> >& s, vector<int>& c, vector<double>& regret, vector<int>& last) {
    int ans = 0;
    int day_worst = 0, worst_score = 0;
    FOR(d, 1, D) {
        int update = 0;
        update += s[d-1][t[d-1] - 1];
        last[t[d-1] - 1] = d;
        REP(i, 26) {
            update -= c[i] * (d - last[i]);
        }
        if(worst_score > update) {
            worst_score = update;
            day_worst = d;
        }
        regret[d-1] = sigmoid(worst_score / 1000.0);
        // cerr << "d = " << d << " regret = " << regret[d-1] << endl;
        ans += update;
    }
    return ans;
}

std::random_device rnd;     // 非決定的な乱数生成器を生成
std::mt19937 mt(rnd());     //  メルセンヌ・ツイスタの32ビット版、引数は初期シード値
std::uniform_int_distribution<> rand_contest(1, 26); 

void get_greedy_init_solution(vector<int>& t, vector< vector<int> >& s, vector<int>& c) {
    vector<int> last(26, 0);
    int ans = 0;
    FOR(d, 1, D) {
        int update = -1e9, arg_max = 0;
        REP(contest, 26) {
            int update_tmp = 0;
            t[d-1] = contest;
            update_tmp += s[d-1][t[d-1] - 1];
            REP(i, 26) {
                if(i != contest)
                    update_tmp -= c[i] * (d - last[i]);
            }
            if(update_tmp > update) {
                update = update_tmp;
                arg_max = contest;
            }
        }
        t[d-1] = arg_max + 1;
        last[t[d-1]-1] = d;
        ans += update;
    }
    return;
}

int main() {
    cin >> D;
    vector<int> c(26);
    REP(i, 26) cin >> c[i];
    vector< vector<int> > s(D+1, vector<int>(26));
    REP(i, D) REP(j, 26) cin >> s[i][j];

    vector<int> t(D, 1);
    get_greedy_init_solution(t, s, c);
    int M = 50000;
    int score = calc_score(t, s, c);

    std::uniform_int_distribution<> rand_day(1, D); 
    std::random_device seed_gen;
    std::default_random_engine engine(seed_gen());
    int day = rand_day(mt);

    cerr << "init score  = " << score << endl;
    vector<double> regret(D);
    vector<int> t_old(D), last(D, 0);
    REP(i, D) t_old[i] = t[i];
    REP(trial, M) {
        REP(i, D) last[i] = 0;
        int new_score = calc_score_with_report(t, s, c, regret, last);
        double temp = (M - trial) / M;
        double prob = exp((new_score - score)/temp);
        if(prob > (rand()%INF)/(double)INF) {
            score = new_score;
            day = rand_day(mt);
        } else {
            day = rand_day(mt);
            REP(i, D) t[i] = t_old[i];
        }
        REP(i, D) t_old[i] = t[i];
        
        if(prob < (rand()%INF)/(double)INF) {
            int arg_day = 0;
            arg_day = rand_day(mt);
            int score = -1e9, new_contest = 0;
            REP(contest, 26) {
                int tmp = 0;
                tmp += s[arg_day][contest];
                REP(i, 26) {
                    if(contest != i)
                        tmp -= c[i] * (arg_day - last[i]);
                }
                if(score < tmp) {
                    new_contest = contest;
                    score = tmp;
                }
            }
            t[arg_day] = new_contest + 1;
        } else {
            int day = rand_day(mt);
            t[day-1] = rand_contest(mt);
        }
    }

    cerr << "final score = " << score << endl;
    REP(i, D) {
        cout << t[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4156