#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)
{
    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 and value:" << i << " "
                 << fixed << setprecision(4) << (ld)v / 1000.0 << endl;
            v << 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;

    ll mx = -infl;
    vll ans(D, 0);

    //ans:答えをＤ日分入力
    //last[i]:i番目のコンテストを最後に行ったのはlast[i]日
    ll max_iter = 200000;
    ll q = 10;
    rep(i,q){
        vll now_ans(D);
        rep(i, D) now_ans[i] = (mt() % 26);
        ll vnow = rand_search(now_ans, max_iter / q);
        if (vnow>mx){
            ans = now_ans;
            mx = vnow;
        }
    }
    if (debug)
        cout << "start value:" << fixed << setprecision(4) << (ld)mx / 1000.0 << ENDL;
    mx = rand_search(ans, max_iter / q);
    clock_t end = clock();
    if (debug){

        //<< fixed << setprecision(2) << res << endl;
        cout << "final value :" << fixed << setprecision(4) << (ld)mx / 1000.0 << 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: 3760