#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
using namespace std;
int D;
int c[27], s[400][27];
int L[27];
int last[27];
long long ANS = 0;
long long ans = 0;
int T[400];
inline long long test(){
    for (int i = 1; i <= 26; i++){
        last[i] = 0;
    }
    long long ans = 0;
    for (int i = 1; i <= D; i++){
        ans += s[i][T[i]];
        last[T[i]] = i;
        for (int j = 1; j <= 26; j++){
            ans -= c[j]*(i-last[j]);
        }
    }
    return ans;
}

inline bool P(long long c1, long long c2, long long temp){
    if (c1 > c2) return 1;
    else return exp(-temp*(c2-c1)/70000) >= rand()/32767.0;
}
long long totalscore = 0;
const int NUMTRIES = 1;
int main(){
    srand(time(NULL));
    for (int i = 1; i <= NUMTRIES; i++){
        //printf("Try %d/%d: ",i,NUMTRIES);
        auto begin_time=chrono::steady_clock::now().time_since_epoch().count();
        D=365; ANS = 0;
        scanf("%d",&D);
        for (int i = 1; i <= 26; i++) c[i] = scanf("%d",&c[i]);
        for (int i = 1; i <= D; i++){
            for (int j = 1; j <= 26; j++) s[i][j] = scanf("%d",&s[i][j]);
        }
        for (int i = 1; i <= 26; i++) L[i] = 0;
        for (int i = 1; i <= D; i++){
            int b1 = -1;
            long long ok = 0;
            for (int t = 1; t <= 26; t++){
                for (int x = 1; x <= 26; x++){
                    for (int y = 1; y <= 26; y++){
                        ans = ANS;
                        for (int j = 1; j <= 26; j++){
                            last[j] = L[j];
                        }

                            ans += s[i][t];
                            last[t] = i;

                            for (int j = 1; j <= 26; j++){
                                ans -= c[j]*(i-last[j]);
                            }

                        if (i != D){
                            ans += s[i+1][x];
                            last[x] = i+1;
                            for (int j = 1; j <= 26; j++){
                                ans -= c[j]*(i+1-last[j]);
                            }
                        }

                        if (i < D-1){
                            ans += s[i+2][y];
                            last[y] = i+2;
                            for (int j = 1; j <= 26; j++){
                                ans -= c[j]*(i+2-last[j]);
                            }
                        }

                        if (b1 == -1 || ans > ok){
                            b1 = t;
                            ok = ans;
                        }
                    }
                }
                //printf("for %d: %lld\n",t,ans);
            }
            T[i] = b1;
            ANS += s[i][b1];
            L[b1] = i;
            for (int j = 1; j <= 26; j++){
                ANS -= c[j]*(i-L[j]);
            }
            //printf("%d\n",b1);
            //printf("score %lld\n",ANS);
        }
        long long best = ANS;
        //printf("from %lld\n",best);
        srand(time(NULL));
        int curT = 0;
        //int curM = 0;
        while (chrono::steady_clock::now().time_since_epoch().count()-begin_time<1900000000){
            curT++;
            int rD = rand()%365+1;
            int rV = rand()%26+1;
            int oldV = T[rD];
            T[rD] = rV;
            long long cur = test();
            if (P(cur,best,curT)){
                best = cur;
                //curM++;
            }
            else{
                T[rD] = oldV;
            }
        }
        //printf("%d mutations, %d successful\n",curT,curM);
        //printf("to %lld\n",best);
        for (int i = 1; i <= D; i++){
            printf("%d\n",T[i]);
        }
        totalscore += max(1000000+best,0ll);
        //printf("%lld\n",max(1000000+best,0ll));
    }
    //printf("%lld\n",totalscore/NUMTRIES*50);
}


Measured memory_bytes: 4280