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

random_device rnd;
mt19937_64 mt(rnd());

ll c[26], s[370][26], D, last[26];

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] = mt() % 101;
    rep(i, 365) rep(j, 26) s[i][j] = mt() % 20001;
}

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 rand_search(vll &ans, ll iter)
{
    //iter回数の山登りをランダムで行い、最適値を返す。ansを最適解に更新する。
    ll v;
    v = calc_v(ans);
    rep(i, iter)
    {
        ll d, x1, x2;
        d = (mt() % D);
        x1 = ans[d];
        x2 = (mt() % 26);
        ans[d] = x2;
        ll v2 = calc_v(ans);
        if (v < v2)
            v = v2;
        else
            ans[d] = x1;

        if (debug && 0)
            cout << "iter, value:" <<i<<" "<< fixed << setprecision(4) << (ld)v / 1000.0 << ENDL;
    }
    if (debug)
        cout << "end value:" << fixed << setprecision(4) << (ld)v / 1000.0 << ENDL;
    return v;
}

ll calc_sum(ll a1,ll a2, ll a3){
    ll b1, b2, b3;
    b1 = a3 - a2;
    b2 = a2 - a1;
    b3 = a3 - a1;
    return (b1 * (b1 - 1) / 2 + b2 * (b2 - 1) / 2 - b3 * (b3 - 1) / 2);
}

ll rand_search2(vll &ans, ll iter){
    ll v;
    v = calc_v(ans);
    vector<multiset<ll>> idx(26);
    rep(i, D) idx[ans[i]].insert(i);
    rep(i,26){
        idx[i].insert(-1);
        idx[i].insert(D);
    }
    rep(i,iter){
        ll d, x1, x2;
        d = (mt() % D);
        x1 = ans[d];
        x2 = (mt() % 26);
        auto x1_idx = idx[x1].lower_bound(d);
        auto x2_idx = idx[x2].lower_bound(d);
        ll v2 = v;
        ll a1, a2, a3, a4;
        a4 = *(x2_idx);
        x2_idx--;
        a3 = *(x2_idx);
        x1_idx++;
        a2 = *(x1_idx);
        x1_idx--;
        x1_idx--;
        a1 = *(x1_idx);
        v2 += (s[d][x2] - s[d][x1]);
        v2 += ((c[x1] * calc_sum(a1, d, a2)) - (c[x2] * calc_sum(a3, d, a4)));
        if (v < v2){
            v = v2;
            idx[x1].erase(d);
            idx[x2].insert(d);
            ans[d] = x2;
        }

        if (debug && 0)
    {           
                cout << "iter, value:" << i << " " << fixed << setprecision(4) << (ld)v / 1000.0 << ENDL;
                //cout << v << " " << calc_v(ans) << ENDL;
    }
    }
    if (debug)
        cout << "end value:" << fixed << setprecision(4) << (ld)v / 1000.0 << ENDL;
    return v;
}

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);
    rep(i, D) ans[i] = (mt() % 26);
    ll mx = calc_v(ans);

    ll max_iter = 100000;

    ll q = 150;
    rep(i,q){
        vll ans_now(D);
        rep(j, D) ans_now[i] = (mt() % 26);
        ll v_now;
        v_now = rand_search2(ans_now, max_iter);
        if (v_now>mx){
            mx = v_now;
            ans = ans_now;
        }
    }
    if (debug)
        cout << "start value:" << fixed << setprecision(4) << (ld)mx / 1000.0 << ENDL;
    mx = rand_search2(ans, max_iter);
    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: 3744