#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

//https://atcoder.jp/contests/rco-contest-2019-qual/submissions/4238153

#include "sys/time.h"

struct timeval timer_begin, timer_end;
int timer_called;
inline void timer_start() 
{
  timer_called++;
  gettimeofday(&timer_begin, NULL);    
}     
inline double timer_now() 
{         
  timer_called++;
  gettimeofday(&timer_end, NULL);         
  return timer_end.tv_sec - timer_begin.tv_sec +
    (timer_end.tv_usec - timer_begin.tv_usec)/1000000.0;     
}

unsigned int randxor()
{
    static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
    unsigned int t;
    t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}

const int D = 365;
const int N = 26;
int c[N];
int s[D][N];

struct State {
    set<int> st[N];
    int ans[D];

    ll score;

    State() {
        rep(i, N) {
            st[i].insert(-1);
            st[i].insert(D);
        }

        rep(i, D) {
            ans[i] = i%N;
            st[ans[i]].insert(i);
        }
        calcScore();
    }
    ll calcScore() {
        score = 0;
        int last[N] = {};
        rep(i, N) last[i] = -1;
        rep(i, D) {
            last[ans[i]] = i;
            score += s[i][ans[i]];
            rep(j, N) score -= c[j] * (i - last[j]);
        }
        return score;
    }
    ll calcScoreC(int i) {
        return i*(i-1LL)/2;
    }
    ll chang(int i, int y) {
        int x = ans[i];
        if(x == y) return score;
        {
            int pre = *(--st[x].lower_bound(i));
            int pst = *(st[x].upper_bound(i));
            score += c[x] * calcScoreC(i - pre);
            score += c[x] * calcScoreC(pst - i);
            score -= c[x] * calcScoreC(pst - pre);
        }
        {
            int pre = *(--st[y].lower_bound(i));
            int pst = *(st[y].upper_bound(i));

            score -= c[y] * calcScoreC(i - pre);
            score -= c[y] * calcScoreC(pst - i);
            score += c[y] * calcScoreC(pst - pre);
        }
        score -= s[i][x];
        score += s[i][y];
        ans[i] = y;
        st[x].erase(i);
        st[y].insert(i);

        return score;
    }
    void output() {
        rep(i, D) {
            cout << ans[i]+1 << '\n';
        }
    }
};

State sa()
{
    State curState;

    ll curScore = curState.score;
    {
        const double saTimeStart    = timer_now();          // 焼きなまし開始時刻。getTimeは、時間を返す関数
        const double saTimeEnd      = 1.8;     // 焼きなまし終了時刻。m_startTimeはこのプログラム自体の開始時間
        double saTimeCurrent        = saTimeStart;          // 現在の時刻

        while ((saTimeCurrent = timer_now()) < saTimeEnd) // 焼きなまし終了時刻までループ
        {
            int day = randxor()%D;
            int cur = curState.ans[day];
            int nxt = randxor()%N;
            if(cur == nxt) continue;
            const ll nextScore = curState.chang(day, nxt);

            const ll T = saTimeEnd-saTimeStart;         // 焼きなましにかける時間
            const ll t = saTimeCurrent-saTimeStart;     // 焼きなまし法開始からの時間
            const ll R = 10000;
            // スコアが悪くなったときでも、次の状態に移動する遷移する場合はtrue。１次関数を使用。
            const bool FORCE_NEXT = R*(T-t)>T*(rand()%R);

            // スコアが良くなった or 悪くなっても強制遷移
            if (nextScore>curScore || FORCE_NEXT )
            {
                curScore = nextScore;
            }
            else {
                curState.chang(day, cur);
            }
        }
    }

    return curState;
}


int main(){
    timer_start();
    cin.tie(0);
    ios::sync_with_stdio(false);
    {
        int d;
        cin >> d;
        rep(i, N) cin >> c[i];
        rep(i, D) rep(j, N) cin >> s[i][j]; 
    }

    
    auto state = sa();
    state.output();
    return 0;
}

Measured memory_bytes: 3692