//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

int D;
int c[32];
int s[512][32];
int ans[512];

void inp(){
    cin>>D;
    for(int i=1;i<=26;i++){
        cin>>c[i];
    }
    for(int i=1;i<=D;i++){
        for(int j=1;j<=26;j++){
            cin>>s[i][j];
        }
    }
}

void ans_inp(){
    for(int i=1;i<=D;i++){
        cin>>ans[i];
    }
}

void ans_don(){
    for(int i=1;i<=D;i++){
        int mx=-LLONG_MAX;
        int mxi=-1;
        for(int j=1;j<=26;j++){
            if(mx<s[i][j]){
                mx=s[i][j];
                mxi=j;
            }
        }
        ans[i]=mxi;
    }
}
void ans_ran(){
    for(int i=1;i<=D;i++){
        ans[i]=rand()%26+1;
    }
}

int man_calc(bool disp){
    int l[32]={0};
    int man=0;
    for(int i=1;i<=D;i++){
        int n=ans[i];
        l[n]=i;
        man+=s[i][n];
        for(int j=1;j<=26;j++){
            man-=c[j]*(i-l[j]);
        }
        if(disp) cout<<man<<endl;
    }
    return man;
}

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

int change_ans(int i,int n,bool f){
    int ret=0;
    if(f){
        int fr=ans[i];
        ret+=s[i][n];
        ret-=s[i][fr];

        //cout<<ret<<endl;
        int fl=0;
        for(int j=1;j<=i-1;j++){
            if(ans[j]==fr) fl=0;
            else fl++;
        }
        for(int j=i;j<=D;j++){
            if(ans[j]==fr&&j!=i) break;
            ret-=c[fr]*(fl+1);
        }
        //cout<<ret<<endl;
        int tl=0;
        for(int j=1;j<=i-1;j++){
            if(ans[j]==n) tl=0;
            else tl++;
        }
        for(int j=i;j<=D;j++){
            if(ans[j]==n) break;
            ret+=c[n]*(tl+1);
        }
        //cout<<ret<<endl;
    }
    ans[i]=n;
    //cout<<ret<<endl;
    return ret;
}

void solve_C(){
    int M;
    cin>>M;
    int man=man_calc(false);
    //cout<<man<<endl;
    for(int i=0;i<M;i++){
        int from,to;
        cin>>from>>to;
        int cng=change_ans(from,to,true);
        man+=cng;
        cout<<man<<endl;
    }
}

void random_solve(){
    int seed=1234;
    int cnt=6000000;
    srand(seed);
    ans_don();
    int henc=D*2;
    int hent=52;
    int bc=D/2,bt=13;
    for(int i=0;i<=cnt;i++){
        if(i%(cnt/(henc-3))==0){
            henc--;
            //cout<<henc<<endl;
        }
        if(i%(cnt/(hent-3))==0){
            hent--;
            //cout<<","<<hent<<endl;
        }
        int ci=bc+rand()%henc-henc/2;
        while(ci<=0) ci+=D;
        ci%=D;
        bc=ci;
        int tn=bt+rand()%hent-hent/2;
        while(tn<=0) tn+=26;
        tn%=26;
        bt=tn;
        int fn=ans[ci];
        if(tn==fn){
            tn=(tn+1)%26;
        }
        //cout<<ci<<","<<bt<<endl;
        int cng=change_ans(ci,tn,true);
        if(cng<0){
            change_ans(ci,fn,false);
        }
        if(i%(cnt/100)==0){
            //cout<<i<<endl;
            for(int ci=1;ci<=D;ci++){
                for(int tn=1;tn<=26;tn++){
                    int fn=ans[ci];
                    int cng=change_ans(ci,tn,true);
                    if(cng<0){
                        change_ans(ci,fn,false);
                    }
                }
            }
        }
    }
    ans_disp();
    //cout<<man_calc(false)<<endl;
}

signed main(){
    inp();
    //ans_inp();
    //solve_C();
    random_solve();
    return 0;
}



Measured memory_bytes: 3296