#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] = i%N; st[t[i]].insert(i);
    }
}

void make_initial_ans_greedy(){
    vector<int> last(N);
    ll S = 0;
    for(int d = 1; d <= D; d++){
        int proper = -1;
        ll max_sat = -1e9;
        for(int i = 0; i < N; i++){
            ll sum = s[d][i];
            for(int j = 0; j < N; j++){
                if(i != j) sum -= c[j]*(d-last[j]);
            }
            if(sum > max_sat){
                max_sat = sum;
                proper = i;
            }
        }

        t[d] = proper; st[t[d]].insert(d);
        last[t[d]]  = d;
        for(int i = 0; i < N; i++){
            S -= c[i]*(d-last[i]);
        }
        S += s[d][t[d]];
    }
}

ll make_initial_ans(int day_diff){
    vector<int> last(N);
    ll S = 0;
    for(int d = 1; d <= D; d++){
        int proper = -1;
        ll max_sat = -1e9;
        for(int i = 0; i < N; i++){
            ll sum = s[d][i];
            for(int j = 0; j < N; j++){
                for(int k = 0; k <= day_diff && k+d <= D; k++){
                    if(i != j) sum -= c[j]*(d-last[j]);
                }
            }
            if(sum > max_sat){
                max_sat = sum;
                proper = i;
            }
        }

        t[d] = proper; st[t[d]].insert(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;
}

double TIME_LIMIT = 1.9;

double tempratue;

double proba(double d_sat){
    if(d_sat >= 0) return 1;
    return exp(d_sat/tempratue);
}

bool accept_change(ll cur_sat, ll prev_sat){
    return rand_dist(engine) < proba(cur_sat-prev_sat);
}

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(accept_change(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 = 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(accept_change(cur_sat, prev_sat)){
        prev_sat = cur_sat;
        exec_swap(d1, d2);
    }
    return prev_sat;
}

ll try_triple_swap(ll prev_sat){
    int d1 = (rand()%D)+1;
    int d2 = d1+(rand()%13);
    int d3 = d1+(rand()%13);
    if(d2 > D || d3 > D) return prev_sat;
    if(t[d1] == t[d2] || t[d2] == t[d3] || t[d3] == t[d1]) return prev_sat;

    ll cur_sat = calc_swap(prev_sat, d1, d2);
    exec_swap(d1, d2);
    cur_sat = calc_swap(cur_sat, d2, d3);
    if(accept_change(cur_sat, prev_sat)){
        prev_sat = cur_sat;
        exec_swap(d2, d3);
    }else{
        exec_swap(d1, d2);
    }
    return prev_sat;
}

ll solve(){
    clock_t start = clock();
    // make_initial_ans_greedy();
    make_initial_ans(10);
    // make_random_ans();
    ll prev_sat = calc_score();
    int cnt = 0;
    cerr << prev_sat << endl;
    tempratue = 0.00;
    while(true){
        clock_t cur_time = clock();
        if(rand()%3 <= 1){
            prev_sat = try_change(prev_sat);
        }else if(rand()%4 == 0){
            prev_sat = try_swap(prev_sat);            
        }else{
            prev_sat = try_triple_swap(prev_sat);
        }
        double remaining_time = TIME_LIMIT - (double)(cur_time-start)/CLOCKS_PER_SEC;
        if(remaining_time < 0.0) break;
        cnt++;
        if(cnt%100 == 0) tempratue = (remaining_time*remaining_time)*500.0;
        if(cnt%100000 == 0) cerr << prev_sat << ' ' << tempratue << endl;
    }
    cerr << prev_sat << ' ' << cnt << 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: 4664