#include <bits/stdc++.h>
#include <chrono>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}

ll calc(mat &s, vec &c, vec &ans){
    ll res = 0;
    vec last(26, 0);
    rep(day, N){
        last[ans[day]] = day + 1;
        rep(i, 26){
            if(i == ans[day]){
                res += s[day][i];
            }else{
                res -= c[i] * (day + 1 - last[i]);
            }
        }
    }
    return res;
}
int temperature_num(0);
const double T1 = 2e+3, T2 = 6e+1;
double Tnow = T1;

int main() {
    clock_t st = clock();
    random_device seed;
    mt19937 mt(seed());
    uniform_int_distribution<> rand360(0, 359), rand5(0, 4), rand26(0, 25);
    uniform_real_distribution<> rand01(0, 1);
    int time_rest, time_sample_num = 200; //around 10 ~ 100[ms]
    const int time_sample_num_mini = 20; //time_sample_num * (0.1 ~ 0.01)
    bool on_CL = false;
    const int MAX_TIME = (CLOCKS_PER_SEC * 200) / 111;  //In AtCoder C++(gcc), CLOCKS_PER_SEC = 1000000 | In CLion, CLOCKS_PER_SEC = 1000

    cin>>N;
    vec c(26), last(26, 0), ans(N);
    mat s(N, vec(26));
    rep(i,26) cin>>c[i];
    rep(i,N) rep(j, 26) cin>>s[i][j];
    ll score = 0;
    rep(day, N){
        vec temp(26, 0);
        rep(i, 26) temp[i] += s[day][i];
        rep(i, 26) temp[i] += c[i] * (day + 1 - last[i]);
        auto ite = max_element(ALL(temp));
        ans[day] = ite - temp.begin();
        last[ite - temp.begin()] = day + 1;
        rep(i, 26){
            if(i == ans[day]){
                score += s[day][i];
            }else{
                score -= c[i] * (day + 1 - last[i]);
            }
        }
    }
    auto temp_st = chrono::system_clock::now();
    rep(_, time_sample_num){
        ++temperature_num;
        if(temperature_num%100 == 0){
            double now_t = (double)(chrono::system_clock::now() - temp_st).count() * (on_CL ? 1e-6 : 1e-3) / MAX_TIME;
            Tnow = pow(T1, 1.0 - now_t) * pow(T2, now_t);
        }
        int fday = rand360(mt);
        int len = rand5(mt);
        if(len == 0){
            int temp = ans[fday];
            ans[fday] = rand26(mt);
            ll temp_score = calc(s, c, ans);
            if(!chmax(score, temp_score)){
                double comp = rand01(mt);
                if(exp((double)(temp_score - score) / Tnow) > comp) score = temp_score;
                else ans[fday] = temp;
            }
        }else{
            swap(ans[fday], ans[fday + len]);
            ll temp_score = calc(s, c, ans);
            if(!chmax(score, temp_score)){
                double comp = rand01(mt);
                if(exp((double)(temp_score - score) / Tnow) > comp) score = temp_score;
                else swap(ans[fday], ans[fday + len]);
            }
        }
    }
    int time_sample = (chrono::system_clock::now() - temp_st).count() / 1000;
    if(on_CL) time_sample /= 1000;
    (time_sample_num *= 9) /= 10;
    while((time_rest = MAX_TIME - (clock() - st)) > 0) {
        int num = max(time_sample_num_mini, (time_rest / time_sample) * time_sample_num);
        rep(_, num){
            ++temperature_num;
            if(temperature_num%100 == 0){
                double now_t = (double)(chrono::system_clock::now() - temp_st).count() * (on_CL ? 1e-6 : 1e-3) / MAX_TIME;
                Tnow = pow(T1, 1.0 - now_t) * pow(T2, now_t);
            }
            int fday = rand360(mt);
            int len = rand5(mt);
            if(len == 0){
                int temp = ans[fday];
                ans[fday] = rand26(mt);
                ll temp_score = calc(s, c, ans);
                if(!chmax(score, temp_score)){
                    double comp = rand01(mt);
                    if(exp((double)(temp_score - score) / Tnow) > comp) score = temp_score;
                    else ans[fday] = temp;
                }
            }else{
                swap(ans[fday], ans[fday + len]);
                ll temp_score = calc(s, c, ans);
                if(!chmax(score, temp_score)){
                    double comp = rand01(mt);
                    if(exp((double)(temp_score - score) / Tnow) > comp) score = temp_score;
                    else swap(ans[fday], ans[fday + len]);
                }
            }
        }
    }
    rep(i,N) cout<<ans[i] + 1<<'\n';
}


Measured memory_bytes: 4440