#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;

int D;
vector<int> down(26);
vector<vector<int>> up;
vector<set<int>> daylist(26);//開催日リスト(0-indexed)
vector<int> tlist;
ll firstans=0;
ll bestans;
vector<int> besttlist;

ll allsum(int n){//1からnまでの総和
    return n*(n+1)/2;
}

ll changescore(int day,int newcontest){//1点変更によるスコアの変化分
    ll cha=0;
    int oldcontest=tlist.at(day);
    if(oldcontest==newcontest)return cha;
    cha+=up.at(day).at(newcontest)-up.at(day).at(oldcontest);
    int oldb,oldn,newb,newn;
    auto olditr=lower_bound(daylist.at(oldcontest).begin(),daylist.at(oldcontest).end(),day);
    auto newitr=lower_bound(daylist.at(newcontest).begin(),daylist.at(newcontest).end(),day);
    olditr--;
    oldb=*olditr;
    olditr++;olditr++;
    oldn=*olditr;
    newn=*newitr;
    newitr--;
    newb=*newitr;
    cha+=down.at(oldcontest)*(allsum(day-oldb-1)+allsum(oldn-day-1)-allsum(oldn-oldb-1));
    cha+=down.at(newcontest)*(allsum(newn-newb-1)-allsum(day-newb-1)-allsum(newn-day-1));
    return cha;
}

void change(int day,int newcontest){//1点変更の反映操作
    firstans+=changescore(day,newcontest);
    int oldcontest=tlist.at(day);
    tlist.at(day)=newcontest;
    daylist.at(oldcontest).erase(day);
    daylist.at(newcontest).insert(day);
    return;
}

ll swapscore(int day1,int day2){
    ll cha=0;
    int contest1=tlist.at(day1),contest2=tlist.at(day2);
    if(contest1==contest2)return cha;
    ll before=firstans;
    change(day1,contest2);
    change(day2,contest1);
    cha=firstans-before;
    change(day1,contest1);
    change(day2,contest2);
    return cha;
}

void Swap(int day1,int day2){
    int contest1=tlist.at(day1),contest2=tlist.at(day2);
    change(day1,contest2);
    change(day2,contest1);
    return;
}

int main() {
    std::chrono::system_clock::time_point  start, end; // 型は auto で可
    start = std::chrono::system_clock::now();

    cin>>D;
    rep(i,26)cin>>down.at(i);
    up.resize(D,vector<int>(26));
    rep(i,D)rep(j,26)cin>>up.at(i).at(j);
    
    //初期値をランダム生成
    tlist.resize(D);
    rep(i,D){
        tlist.at(i)=rand()%26;//0-indexed
        //cin>>tlist.at(i);
        //tlist.at(i)--;
    }

    besttlist.resize(D);
    rep(i,D){
        besttlist.at(i)=tlist.at(i);
    }
    
    //リストに格納
    rep(i,26){
        daylist.at(i).insert(-1);
    }
    rep(i,D){
        daylist.at(tlist.at(i)).insert(i);
    }
    rep(i,26){
        daylist.at(i).insert(D);
    }
    //初期解の計算
    firstans=0;
    rep(i,D){
        firstans+=up.at(i).at(tlist.at(i));
    }
    rep(i,26){
        auto itr=daylist.at(i).begin();
        rep(cou,daylist.at(i).size()-1){
            int bday=*itr;
            itr++;
            int today=*itr;
            int span;
            span=today-bday-1;
            firstans-=down.at(i)*allsum(span);
        }
    }

    /*rep(i,D){
        cout<<tlist.at(i)+1<<endl;
    }
    cout<<firstans<<endl;*/

    bestans=firstans;
    
    ll cnt=0;
    double elapsed;
    double tim;
    double T0=2000.0,T1=600.0,Tnow=T0;
    
    while(elapsed<1950){//時間が許す限り
        cnt++;
        if(cnt%100==0){
            tim=elapsed/1950;
            Tnow=pow(T0,1.0-tim)*pow(T1,tim);
        }
        int changeorswap=rand()%2;
        if(changeorswap){
            int da=rand()%D,newc=rand()%26;
            if(changescore(da,newc)>0){
                change(da,newc);
                //cout<<firstans<<endl;
            }
            else{
                double x=(double)rand()/RAND_MAX;
                double p=exp((double)changescore(da,newc)/Tnow);
                if(x<p)change(da,newc);
            }
            //else cout<<endl;
        }
        else{
            int da1=rand()%D,da2=rand()%D;
            if(swapscore(da1,da2)>0){
                Swap(da1,da2);
                //cout<<firstans<<endl;
            }
            else{
                double x=(double)rand()/RAND_MAX;
                double p=exp((double)swapscore(da1,da2)/Tnow);
                if(x<p)Swap(da1,da2);
            }
            //else cout<<endl;
        }

        if(firstans>bestans){
            bestans=firstans;
            rep(i,D){
                besttlist.at(i)=tlist.at(i);
            }
        }

        end = std::chrono::system_clock::now();  // 計測終了時間
        elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();

//cout<<firstans<<endl;
    }

    //cout<<firstans<<endl;
    rep(i,D){
        cout<<besttlist.at(i)+1<<endl;
    }
}

Measured memory_bytes: 4380