#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;
}

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); 
    int day1 = rand_day(mt), day2 = rand_day(mt);

    cerr << "init score  = " << score << endl;

    int old_contest1 = -1, old_contest2 = -1;

    REP(trial, M) {
        int new_score = calc_score(t, s, c);
        
        double temp = (M - trial) / M;
        double prob = exp((new_score - score)/temp);
        if(prob > (rand()%INF)/(double)INF) {
            score = new_score;
        } else {
            if(old_contest2 == -1)
                t[day1-1] = old_contest1;
            else {
                t[day1-1] = old_contest1;
                t[day2-1] = old_contest2;
            }
        }

        if(rand()%2 == 0) {
            day1 = rand_day(mt);
            int contest = rand_contest(mt);
            old_contest1 = t[day1-1];
            old_contest2 = -1;
            t[day1-1] = contest;

        } else {
            day1 = rand_day(mt);
            day2 = min(D, day1 + rand() % 16);
            old_contest1 = t[day1-1];
            old_contest2 = t[day2-1];
            t[day1-1] = old_contest2;
            t[day2-1] = old_contest1;
        }
    }

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


Measured memory_bytes: 3888