#ifndef COMPETITIVE_HEADER
    #pragma GCC optimize ("Ofast")
    #ifdef ONLINE_JUDGE
        #pragma GCC target ("avx512f")
    #else
        #pragma GCC target ("avx")
    #endif
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%d", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;
#endif

inline unsigned long long rdtsc()
{
#ifdef __amd64
  unsigned long long a, d;
  __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
  return (d << 32) | a;
#else
  unsigned long long x;
  __asm__ volatile ("rdtsc" : "=A" (x));
  return x;
#endif
}

inline double gettime(){return rdtsc()/2993344000.0;}
inline double elapsed(double st){return gettime()-st;}
uint32_t xor128() { 
    static uint64_t x = 88172645463325252ULL;
    x = x ^ (x << 13); x = x ^ (x >> 7);
    return x = x ^ (x << 17);
}

const int D = 365;
int c[26], s[365][26], t[365];
int lst[26];
set<int> hold[26];
int satisfy;

void input(){
    I(c[0]);
    REP(i,26) I(c[i]);
    REP(i,D) REP(j,26) I(s[i][j]);
}

int score(){
    satisfy = 0;
    REP(i,26) lst[i] = 0;
    REP(i,D){
        int dlst = i+1 - lst[t[i]];
        lst[t[i]] = i+1;
        satisfy += s[i][t[i]];
        satisfy -= c[t[i]] * dlst * (dlst-1) / 2;
    }
    REP(i,26) satisfy -= c[i] * (365-lst[i]) * (365-lst[i]+1) / 2;
    return satisfy;
}

const double startTemp = 7000;
const double limittime = 1.95;
    int nroll = 0;

void exec(){
    double st = gettime();
    REP(i,D){
        t[i] = max_element(s[i], s[i] + 26) - s[i];
        hold[t[i]].insert(i+1);
    }

    int tmp = score();
    double tim = elapsed(st);
    while(tim < limittime){
        REP(_,500){
            int day_ch = xor128() % 365;
            int con_ch = xor128() % 26;
            if (t[day_ch] == con_ch) continue;

            int dscore = s[day_ch][con_ch] - s[day_ch][t[day_ch]];
            auto it = hold[t[day_ch]].lower_bound(day_ch+1);
            int prv = *prev(it,1);
            int nxt = *next(it,1);
            
            // cout << t[day_ch] << " " << prv << " " << day_ch+1 << " " << nxt << "; " ;

            dscore += c[t[day_ch]] * ((nxt-day_ch-1) * (nxt-day_ch-2) / 2 +
                    (day_ch+1-prv) * (day_ch-prv) / 2 - (nxt-prv) * (nxt-prv-1) / 2);
            auto it2 = hold[con_ch].lower_bound(day_ch+1);
            nxt = *it2;
            prv = *prev(it2,1);

            // cout << con_ch << " " << prv << " " << day_ch+1 << " " << nxt << "; " ;

            dscore -= c[con_ch] * ((nxt-day_ch-1) * (nxt-day_ch-2) / 2 +
                    (day_ch+1-prv) * (day_ch-prv) / 2 - (nxt-prv) * (nxt-prv-1) / 2);
            
            // int ttmp = t[day_ch];
            // t[day_ch] = con_ch;
            // cout << dscore << " " << score() - tmp << endl;
            // t[day_ch] = ttmp;

            double temper = startTemp * (1.0 -  tim / limittime * tim / limittime);
            double prob = exp(dscore/temper);
            // cerr << dscore << " " << prob << endl;
            bool do_exch = prob * UINT32_MAX > xor128();
            if(do_exch){
                hold[t[day_ch]].erase(day_ch+1);
                hold[con_ch].insert(day_ch+1);
                t[day_ch] = con_ch;
                
                tmp += dscore;
            }
        }
        tim = elapsed(st);
        nroll += 500;
        cerr << tim << " " << tmp <<  endl;
    }
    
}

void judge(){
    input();
    exec();
}

void test(){
    REP(i,26) c[i] = xor128() % 101;
    REP(i,D) REP(j,26) s[i][j] = xor128() % 20001;
    exec();
}

int main(){
    REP(i,26){
        hold[i].insert(0);
        hold[i].insert(366);
    }
    #ifdef ONLINE_JUDGE
        judge();
    #else 
        test();
    #endif
    REP(i,D) printf("%d\n", t[i]+1);
    cerr << score() << endl;
}

Measured memory_bytes: 4564