#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
#include <chrono>
#include <random>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define repr(i, a, b) for (int i = (int)a; i > (int)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 1147483600;
const ll infl = 4e18 + 5;
const char ENDL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;

bool debug = false;


static uint32_t mt(){
    static uint32_t x = 123456789;
    static uint32_t y = 362436069;
    static uint32_t z = 521288629;
    static uint32_t w = 88675123;
    uint32_t t;
    t = x ^ (x << 11);
    x = y;
    y = z;
    z = w;
    return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}




random_device rnd;
mt19937 mt11(rnd());

static double mt01()
{
    return (mt() + 0.5) * (1.0 / UINT_MAX);
}

ll c[26], s[370][26], D, last[26];
ld START_TEMP = 10000;
ld END_TEMP = 100;
ld END_TIME = 1950;

void input(){
    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D) rep(j, 26) cin >> s[i][j];
}

void make_input(){
    rep(i, 365) c[i] = mt11() % 101;
    rep(i, 365) rep(j, 26) s[i][j] = mt11() % 20001;
}

void init_ans(vll &ans)
{
    rep(i, D) ans[i] = (mt() % 26);
}

ll calc_v(vll t){
    vll v(D, 0);
    rep(i, 26) last[i] = -1;
    rep(i,D){
        if (i>0)
            v[i] = v[i - 1];
        v[i] += s[i][t[i]];
        last[t[i]] = i;
        rep(j, 26) v[i] -= c[j] * (i - last[j]);
    }
    return v[D-1];
}

ll calc_vd(vll t,ll d,ll x){
    ll pre = d - 1;
    ll nex = d + 1;
    while(pre>=0 && t[pre]!=x)
        pre--;
    while(nex<D && t[nex]!=x)
        nex++;
    return ((d - pre) * (nex - d) * c[x] + s[d][x]);
}

ll SimulatedAnnealing(vll &ans, clock_t start){
    ll cnt = 0;
    ll v = calc_v(ans);
    ll mx = v;
    vll t = ans;
    ld temp = START_TEMP;
    while (true){
        if (cnt%10000==0){
            clock_t now = clock();
            if ((static_cast<ld>(now - start) / CLOCKS_PER_SEC * 1000.0) > 1950)
            {
                if (debug)
                    cout << "end iter :" << cnt << ENDL;
                break;
            }
            temp = START_TEMP + (END_TEMP - START_TEMP) * ((static_cast<ld>(now - start) / CLOCKS_PER_SEC * 1000.0) / END_TIME);
            if (debug && cnt%500000==0)
                cout << "iter, value:" << cnt/500000 << " " << fixed << setprecision(4) << (ld)mx / 1000.0 << ENDL;
        }
        if (mt01()>0.5 || 1){
            int d = (mt() % D);
            int x1 = t[d];
            int x2 = (mt() % 26);
            ld delta;
            delta = (calc_vd(t, d, x2) - calc_vd(t, d, x1));
            if (exp(delta/temp)>mt01()){
                v += delta;
                t[d] = x2;
                if (mx < v){
                    mx = v;
                    ans = t;
                }
            }
        }
        else{}
        cnt++;
    }
    return mx;
}




int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    clock_t start = clock();
    D = 365;
    if(debug)
        make_input();
    else
        input();
    rep(i, 26) last[i] = -1;
    vll ans(D, 0);
    init_ans(ans);
    ll mx = calc_v(ans);
    if (debug)
        cout << "start value:" << fixed << setprecision(4) << (ld)mx / 1000.0 << ENDL;
    mx = SimulatedAnnealing(ans, start);
    clock_t end = clock();
    if (debug){
        cout << "final value :" << fixed << setprecision(4) << (ld)mx / 1000.0 << ENDL;
        cout << "point : " << mx * 50 << ENDL;
        cout << "check :" << ((*min_element(all(ans)) >= 0) && (*max_element(all(ans)) <= 25)) << ENDL;
        ld time = static_cast<ld>(end - start) / CLOCKS_PER_SEC * 1000.0;
        cout << "time :" << fixed << setprecision(3) << time << "ms" << ENDL;
        }
    else
        rep(i, D) cout << ans[i] + 1 << ENDL;
}


Measured memory_bytes: 3828