#include <iostream>
#include <random>
#include <cstring>

using namespace std;
struct Timer {
    static const unsigned long TICKS_PER_MSEC=3e6;
    unsigned long t1;
    Timer() { reset(); }
    unsigned long elapsed() { return gettime()-t1; }
    double elapsedMsec() { return 1.0*elapsed()/TICKS_PER_MSEC; }
    void reset() { t1=gettime(); }
    unsigned long gettime()
    {
        unsigned long lo, hi;
        asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
        return (hi<<32)|lo;
    }
};

int c[27], s[366][27], t[366], last[367][27], tlast[367][27];
int main()
{
    Timer timer;
    int D; 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];

    auto calc_score=[&](){
        long score=0;
        memset(last, 0, sizeof(last));
        for(int d=1; d<=D; ++d) {
            score+=s[d][t[d]];
            last[d][t[d]]=d;
            for(int i=1; i<=26; ++i) {
                last[d+1][i]=last[d][i];
                score-=c[i]*(d-last[d][i]);
            }
        }
        return score;
    };
    // t[i]=q
    auto calc_diff=[&](int i, int p, int q){
        long ds=0;
        ds-=s[i][p];
        ds+=s[i][q];
        for(int d=i; d<=D; ++d) {
            ds+=c[p]*(d-tlast[d][p]);
            ds+=c[q]*(d-tlast[d][q]);
        }
        tlast[i][p]=tlast[i-1][p];
        for(int d=i+1; d<=D; ++d) {
            if (t[d]==p) break;
            tlast[d][p]=tlast[d-1][p];
        }
        tlast[i][q]=i;
        for(int d=i+1; d<=D; ++d) {
            if (t[d]==q) break;
            tlast[d][q]=tlast[d-1][q];
        }
        for(int d=i; d<=D; ++d) {
            ds-=c[p]*(d-tlast[d][p]);
            ds-=c[q]*(d-tlast[d][q]);
        }
        return ds;
    };

    for(int i=1; i<=D; ++i) {
        long bestscore=-(1L<<60), typ=1;
        for(int j=1; j<=26; ++j) {
            t[i]=j;
            auto score=calc_score();
            t[i]=0;
            if (bestscore<score) {
                bestscore=score;
                typ=j;
            }
        }
        t[i]=typ;
    }

    mt19937 engine;
    uniform_int_distribution<> rndT(1, 26), rndD(1, 365), rndR(0, 2);
    auto bestscore=calc_score();

    int cnt=0;
    while (timer.elapsedMsec()<1950) {
        if (!rndR(engine)) {
            int d=rndD(engine);
            int q=rndT(engine);
            int p=t[d];
            t[d]=q;
            memcpy(tlast, last, sizeof(last));
            auto dscore=calc_diff(d, p, q);
            if (dscore>0) {
                bestscore+=dscore;
                memcpy(last, tlast, sizeof(last));
            }
            /*
            auto score=calc_score();
            if (bestscore<score) {
                bestscore=score;
            }
            */
            else {
                t[d]=p;
            }
        }
        else {
            int a=rndD(engine);
            int b=rndD(engine);
            swap(t[a], t[b]);
            auto score=calc_score();
            if (bestscore<score) {
                bestscore=score;
            }
            else {
                swap(t[a], t[b]);
            }
        }
        ++cnt;
    }
    for(int i=1; i<=D; ++i) cout<<t[i]<<endl;
    //cout<<bestscore<<", "<<cnt<<endl;
}


Measured memory_bytes: 3664