#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <time.h>
#include <random>

using namespace std;
typedef long long ll;

int N = 26;
int D;
ll c[26];
ll s[366][36];
ll s_sum[367][36];
int t[366];
set<int> st[26];

random_device seed_gen;
default_random_engine engine(seed_gen());
uniform_real_distribution<> rand_dist(0.0, 1.0);

void input(){
    cin >> D;
    for(int i = 0; i < N; i++) {
        cin >> c[i];
        st[i].insert(0); st[i].insert(D+1);
    }
    for(int i = 1; i <= D; i++){
        for(int j = 0; j < N; j++) cin >> s[i][j];
    }
    for(int i = D; i >= 1; i--){
        for(int j = 0; j < N; j++){
            s_sum[i][j] = s_sum[i+1][j]+s[i][j];
        }
    }
}


ll calc_score(){
    vector<int> last(N);
    ll S = 0;
    for(int d = 1; d <= D; d++){
        last[t[d]]  = d;
        for(int i = 0; i < N; i++){
            S -= c[i]*(d-last[i]);
        }
        S += s[d][t[d]];
    }
    return S;
}

ll calc_change(ll prev, int d, int q){
    prev -= s[d][t[d]]; prev += s[d][q];
    // t[d]がなくなる
    {
        auto l = st[t[d]].find(d); l--;
        auto r = st[t[d]].upper_bound(d);
        ll dif_l = d-*l, dif_r = *r-d;
        prev -= (dif_l)*(dif_r)*c[t[d]];
    }
    // qが増える
    {
        auto l = st[q].lower_bound(d); l--;
        auto r = st[q].upper_bound(d);
        ll dif_l = d-*l, dif_r = *r-d;
        prev += (dif_l)*(dif_r)*c[q];
    }
    return prev;
}

void change(int d, int q){
    st[t[d]].erase(d); st[q].insert(d);
    t[d] = q;
}

ll calc_swap(ll prev_sat, int d1, int d2){
    int q1 = t[d1], q2 = t[d2];
    ll tmp_sat = calc_change(prev_sat, d1, q2);
    change(d1, q2);
    ll ans = calc_change(tmp_sat, d2, q1);
    change(d1, q1);
    return ans;
}

void exec_swap(int d1, int d2){
    int q1 = t[d1], q2 = t[d2];
    change(d1, q2);
    change(d2, q1);
}

void output(){
    for(int i = 1; i <= D; i++) cout << t[i]+1 << endl;
}

void make_random_ans(){
    for(int i = 1; i <= D; i++){
        // t[i] = rand()%N; st[t[i]].insert(i);
        t[i] = i%N; st[t[i]].insert(i);
    }
}

double TIME_LIMIT = 1.8;

double p_th(double cur_time){
    double p = 0.8;
   return p+(1.0-p)*(cur_time/TIME_LIMIT);
}

ll try_change(ll prev_sat){
    int d = (rand()%D)+1, q = (rand()%N);
    ll cur_sat = calc_change(prev_sat, d, q);
    if(t[d] == q) return prev_sat;
    if(cur_sat > prev_sat){
        prev_sat = cur_sat;
        change(d, q);
    }
    return prev_sat;
}

ll try_swap(ll prev_sat){
    int d1 = (rand()%D)+1;
    // int d2 = (rand()%D)+1;
    int d2 = d1+(rand()%13);
    if(d2 > D) return prev_sat;
    if(t[d1] == t[d2]) return prev_sat;
    ll cur_sat = calc_swap(prev_sat, d1, d2);
    if(cur_sat > prev_sat){
        prev_sat = cur_sat;
        exec_swap(d1, d2);
    }else{
        // if(rand_dist(engine) > p_th((double)(cur_time-start)/CLOCKS_PER_SEC)) {
        //     prev_sat = cur_sat;
        //     exec_swap(d1, d2);
        // }
    }
    return prev_sat;
}

ll solve(){
    make_random_ans();
    clock_t start = clock();
    ll prev_sat = calc_score();
    int cnt = 0;

    while(true){
        clock_t cur_time = clock();
        if(rand()%3 == 0){
            prev_sat = try_swap(prev_sat);
        }else{
            prev_sat = try_change(prev_sat);
        }
        if((double)(cur_time-start)/CLOCKS_PER_SEC >= TIME_LIMIT) break;
        // if(cnt%10000 == 0) cerr << prev_sat << endl;
        cnt++;
    }
    cerr << prev_sat << endl;
    return prev_sat;
}

void reset(){
    for(int i = 1; i <= D; i++) t[i] = 0;
    for(int i = 0; i < N; i++){
        st[i].clear();
        st[i].insert(0); st[i].insert(D+1);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    input();
    solve();
    output();
}

Measured memory_bytes: 3892