#include <iostream>
#include <vector>
#include <random>
#include <set>
using namespace std;

int main(void){
    int D, cbuf, sbuf, tbuf;
    vector<int> c;
    cin >> D;
    vector<vector<int>> s(D, vector<int>(26, 0));
    vector<int> t;
    for(int i=0; i<26; i++){
        cin >> cbuf;
        c.push_back(cbuf);
    }
    for(int i=0; i<D; i++){
        for(int j=0; j<26; j++){
            cin >> sbuf;
            s[i][j] = sbuf;
        }
    }
    for(int i=0; i<D; i++){
        int numbuf = 0;
        for(int j=1; j<26; j++){
            if(s[i][numbuf] < s[i][j]){
                numbuf = j;
            }
        }
        t.push_back(numbuf);
    }
    int satisfaction = 0;
    vector<vector<int>> last(D, vector<int>(26, -1));
    for(int i=0; i<D; i++){
        satisfaction += s[i][t[i]];
        for(int j=0; j<26; j++){
            if(j == t[i]){
                last[i][j] = i;
            }else{
                if(i > 0)last[i][j] = last[i-1][j];
            }
        }
        for(int j=0; j<26; j++){
            satisfaction -= c[j]*(i-last[i][j]);
        }
    }
    int M = 3000000;
    set<pair<int, int>> tested;
    random_device seed_gen;
    mt19937 engine(seed_gen());
    uniform_int_distribution<> distday(0, D-1);
    uniform_int_distribution<> disttest(0, 25);
    for(int i=0; i<M; i++){
        int satisfactionbuf = satisfaction;
        int dbuf = distday(engine);
        int qbuf = disttest(engine);
        int counter = 0;
        bool breakable = false;
        while(tested.find(pair<int, int>(dbuf, qbuf)) != tested.end()){
            dbuf = distday(engine);
            qbuf = disttest(engine);
            counter++;
            if(counter > D*26){
                breakable = true;
                break;
            }
        }
        if(breakable)break;
        tested.insert(pair<int, int>(dbuf, qbuf));
        int oldtest = t[dbuf];
        t[dbuf] = qbuf;
        int j=dbuf;
        int oldlast = -1;
        if(dbuf > 0)oldlast = last[dbuf-1][oldtest];
        int lastdiff = dbuf - oldlast;
        while(j < D){
            if(last[j][oldtest] != dbuf)break;
            if(j <= 0){
                last[j][oldtest] = -1;
            }else last[j][oldtest] = last[j-1][oldtest];
            j++;
        }
        satisfaction -= c[oldtest]*(j-dbuf)*lastdiff;
        j=dbuf;
        oldlast = -1;
        if(dbuf > 0)oldlast = last[dbuf-1][qbuf];
        while(j < D){
            if(last[j][qbuf] != oldlast)break;
            last[j][qbuf] = dbuf;
            j++;
        }
        lastdiff = dbuf - oldlast;
        satisfaction += c[qbuf]*(j-dbuf)*lastdiff;
        satisfaction += s[dbuf][qbuf] - s[dbuf][oldtest];
        if(satisfactionbuf > satisfaction){
            qbuf = oldtest;
            oldtest = t[dbuf];
            t[dbuf] = qbuf;
            j=dbuf;
            oldlast = -1;
            if(dbuf > 0)oldlast = last[dbuf-1][oldtest];
            lastdiff = dbuf - oldlast;
            while(j < D){
                if(last[j][oldtest] != dbuf)break;
                if(j <= 0){
                    last[j][oldtest] = -1;
                }else last[j][oldtest] = last[j-1][oldtest];
                j++;
            }
            satisfaction -= c[oldtest]*(j-dbuf)*lastdiff;
            j=dbuf;
            oldlast = -1;
            if(dbuf > 0)oldlast = last[dbuf-1][qbuf];
            while(j < D){
                if(last[j][qbuf] != oldlast)break;
                last[j][qbuf] = dbuf;
                j++;
            }
            lastdiff = dbuf - oldlast;
            satisfaction += c[qbuf]*(j-dbuf)*lastdiff;
            satisfaction += s[dbuf][qbuf] - s[dbuf][oldtest];
        }
    }
    for(int i=0; i<D; i++)cout << t[i]+1 << endl;
    return 0;
}

Measured memory_bytes: 4180