#pragma GCC target("avx512f,avx512pf,avx512er,avx512cd,avx512vl,avx512bw,avx512dq,avx512ifma,avx512vbmi")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}

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

constexpr int n = 26;
constexpr int d = 365;
constexpr double ep = 1.95;
int c[n];
int s[d][n];
set<int> day[n];
int ret[d];
int ans[d];

int last[n];

inline int calc(){
    int an = 0;
    for(int i = 0; i < n; ++i)
        last[i] = -1;
    for(int i = 0; i < d; ++i){
        an += s[i][ret[i]];
        last[ret[i]] = i;
        for(int j = 0; j < n; ++j)
            an -= c[j] * (i - last[j]);
    }
    return an;
}

inline int update(int k, int q){
    if(ret[k] == q)
        return 0;
    auto aft = day[ret[k]].upper_bound(k);
    auto bef = prev(day[ret[k]].lower_bound(k));
    auto aft2 = day[q].upper_bound(k);
    auto bef2 = prev(day[q].lower_bound(k));
    int lb = k - *bef;
    int rb = *aft - k;
    int mb = lb + rb;
    int lb2 = k - *bef2;
    int rb2 = *aft2 - k;
    int mb2 = lb2 + rb2;

    int m1 = mb * (mb - 1);
    int l1 = lb * (lb - 1);
    int r1 = rb * (rb - 1);

    int m2 = mb2 * (mb2 - 1);
    int l2 = lb2 * (lb2 - 1);
    int r2 = rb2 * (rb2 - 1);

    int score = (c[ret[k]] * (l1 + r1 - m1) + c[q] * (m2 - l2 - r2)) / 2 + s[k][q] - s[k][ret[k]];

    day[ret[k]].erase(k);
    day[q].emplace(k);
    ret[k] = q;
    return score;
}

int best_score;

constexpr int s_temp = 2000;
constexpr int e_temp = 500;

inline bool fn(int score, int next_score, double per){
    double temp = s_temp + (e_temp - s_temp) * per;
    double p = next_score >= score ? 1.0 : exp((next_score - score) / temp);
    double rnd = (1.0 * randxor() / UINT_MAX);
    if(best_score < next_score){
        best_score = next_score;
        memcpy(ans, ret, sizeof(ret));
    }
    return p > rnd;
}

void solve(){
    for(int i = 0; i < n; ++i){
        day[i].emplace(-1);
        day[i].emplace(d);
    }
    for(int i = 0; i < d; ++i){
        int id = (i + 10) % 26;
        ret[i] = id;
        day[ret[i]].emplace(i);
    }

    int score = calc();
    best_score = score;
    clock_t st = clock();
    double cl = 0;
    while(cl < 1){
        cl = (double(clock() - st) / CLOCKS_PER_SEC) / ep;
        for(int _ = 0; _ < 10000; ++_){
            if(randxor() % 4){
                int diff = randxor() % 8 + 1;
                int d1 = randxor() % (d - diff);
                int d2 = d1 + diff;
                int p1 = ret[d1];
                int p2 = ret[d2];
                int next_score = score;
                next_score += update(d1, p2);
                next_score += update(d2, p1);
                if(fn(score, next_score, cl)){
                    score = next_score;
                }else{
                    update(d1, p1);
                    update(d2, p2);
                }
            }else{
                int d1 = randxor() % d;
                int k1 = randxor() % n;
                int b1 = ret[d1];
                int next_score = score + update(d1, k1);
                if(fn(score, next_score, cl)){
                    score = next_score;
                }else{
                    update(d1, b1);
                }
            }
        }
    }
    for(int i = 0; i < d; ++i)
        printf("%d\n", ans[i] + 1);
}


signed main(){
    int d_;
    scanf("%d", &d_);
    for(int i = 0 ; i < 26 ; i++)
        scanf("%d",&c[i]);
    for(int i = 0 ; i < d; i++){
        for(int j = 0 ; j < 26 ; j++){
            scanf("%d",&s[i][j]);
        }
    }
    solve();
    return 0;
}



Measured memory_bytes: 4336