#include <bits/stdc++.h>
#include <math.h>
#include <time.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<bool> vec){
    ll n = vec.size();
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
}

void pr2d(vector<vector<ll>> vvec){
    ll h = vvec.size();
    ll w = vvec.at(0).size();
    rep(i,h){
        rep(j,w){
            cout << vvec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
}

int main(){
    clock_t start = clock();

    ll days; cin >> days;
    vector<ll> c(26);
    rep(i,26) cin >> c.at(i);
    vector<vector<ll>> s(days,vector<ll>(26));
    rep(i,days) rep(j,26) cin >> s.at(i).at(j);
    vector<ll> last(26,0);

    ll sat = 0;

    ll initial_satis=0;
    rep(i,26){
        initial_satis -= c.at(i)*days*(days+1)/2;
    }
    //initial_satis =　何もコンテストを開催していない状態の満足度
    
    ll satis = initial_satis;
    vector<vector<ll>> contlis(26,{0,days+1});    
    vector<ll> cont_order(days);
    
    //////////////////////////////////////////
    
    //ある程度ランダムに生成してたまたま得点が良い組み合わせを探す
    
    while(true){
        clock_t now = clock();
        const double x = static_cast<double>(now - start) / CLOCKS_PER_SEC;
        if(x>0.5) break;


        ll satis_candidate = initial_satis;

        //ランダムに生成して得点の良い解を探す
        srand(time(NULL));
        vector<ll> rand_init(days);
        rep(i,days) rand_init.at(i) = (rand()%26);

        //与えられたtだけコンテストを開催することを考える
        vector<vector<ll>> contlis_candidate(26,{0,days+1});
        for(int i=1;i<=days;i++){
            ll t = rand_init.at(i-1);
            auto it = lower_bound(contlis_candidate.at(t).begin(),contlis_candidate.at(t).end(),i);
            ll x = it - contlis_candidate.at(t).begin();
            ll a = i - contlis_candidate.at(t).at(x-1) - 1;
            ll b = contlis_candidate.at(t).at(x) - i - 1;
            ll z = contlis_candidate.at(t).at(x) - contlis_candidate.at(t).at(x-1) - 1;
            satis_candidate += c.at(t)*z*(z+1)/2 - c.at(t)*a*(a+1)/2 - c.at(t)*b*(b+1)/2;
            satis_candidate += s.at(i-1).at(t);
            contlis_candidate.at(t).insert(it,i);
        }
        if(satis_candidate > satis){
            satis = satis_candidate;
            cont_order = rand_init;
            contlis = contlis_candidate;
        }
    }




    while(true){
        clock_t now = clock();
        const double time = static_cast<double>(now - start) / CLOCKS_PER_SEC;
        if(time>1.950) break;

        ll d = rand()%days, q = rand()%26; //d日目の開催コンテストをq番目のものにする
        //現状d日目に開催されているコンテストは？
        ll cur_cont_d = cont_order.at(d);

        ll diff = 0; //変えたことによる変化量

        //cur_cont_dの開催をやめる
        diff -= s.at(d).at(cur_cont_d);

        //q番目コンテストの分のsatisを増やす
        diff += s.at(d).at(q);

        //cur_cont_d開催中止による飽きの影響
        auto it = lower_bound(contlis.at(cur_cont_d).begin(),contlis.at(cur_cont_d).end(),d+1);
        ll x = it - contlis.at(cur_cont_d).begin();
        ll a = d+1 - contlis.at(cur_cont_d).at(x-1) - 1;
        ll b = contlis.at(cur_cont_d).at(x+1) - (d+1) - 1;
        ll z = contlis.at(cur_cont_d).at(x+1) - contlis.at(cur_cont_d).at(x-1) - 1;

        diff = diff - c.at(cur_cont_d)*z*(z+1)/2 + c.at(cur_cont_d)*a*(a+1)/2 + c.at(cur_cont_d)*b*(b+1)/2;

        //q追加による飽きへの影響
        auto it2 = lower_bound(contlis.at(q).begin(),contlis.at(q).end(),d+1);
        x = it2 - contlis.at(q).begin();
        a = (d+1) - contlis.at(q).at(x-1) - 1;
        b = contlis.at(q).at(x) - (d+1) - 1;
        z = contlis.at(q).at(x) - contlis.at(q).at(x-1) - 1;
        diff += c.at(q)*z*(z+1)/2 - c.at(q)*a*(a+1)/2 - c.at(q)*b*(b+1)/2;
        
        if(diff>0){//採用する場合、様々変える
            satis += diff;
            //d日目の開催コンテストをqに変更する
            cont_order.at(d) = q;
            contlis.at(cur_cont_d).erase(it);
            contlis.at(q).insert(it2,d+1);
        }
        //cout << satis << endl;
    }

    rep(i,days){
        cout << cont_order.at(i) + 1;
        if(i!=(days-1))cout << "\n"; 
    }

    return 0;
}


Measured memory_bytes: 3764