#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;}
class Xorshift128 {
private:
  static constexpr unsigned MASK = 0x7FFFFFFF;
  unsigned x = 123456789, y = 987654321, z = 1000000007, w;
public:
  unsigned rnd(){
    unsigned t = x ^ (x << 11);
    x = y; y = z; z = w;
    w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
    return w & MASK;
  }
  Xorshift128(const unsigned seed) : w(seed) {}
};
Xorshift128 prng(21);

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 = 1150;
const double limittime = 1.985;
    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 = prng.rnd() % 365;
            int con_ch = prng.rnd() % 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);
 
            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);

            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);

            double temper = startTemp * (1.0 -  tim / limittime * tim / limittime);
            double prob = exp(dscore/temper);
            bool do_exch = prob * UINT32_MAX > prng.rnd();
            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);
    }
    
}

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

void test(){
    REP(i,26) c[i] = prng.rnd() % 101;
    REP(i,D) REP(j,26) s[i][j] = prng.rnd() % 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);

}


Measured memory_bytes: 4448