#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<vector<vector<int>>> v3int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef vector<vector<vector<ll>>> v3ll;
typedef list<int> liint;
typedef pair<int, int> pint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, int>> vpll_int;
typedef vector<pair<int, ll>> vpint_ll;
typedef set<pair<int, int>> spint;
typedef set<pair<ll, int>> spll;
typedef unordered_map<int, unordered_set<int>> Graph;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }
const int CON_NUM = 26;


vll score(v2ll& s, vll& c, vll t, int D) {
    ll ans = 0;
    vll vans(D + 1);
    vint last(CON_NUM + 1, 0);
    REP(d, 1, D + 1) {
        ans += s[d][t[d - 1]];
        last[t[d - 1]] = d;
        REP(i, 1, CON_NUM + 1)
            ans -= c[i] * (ll(d) - ll(last[i]));
        vans[d] = ans;
    }
    return vans;

}

ll calc_sub(vector<set<ll>>& con_map, vll& c, ll cn) {
    ll ans = 0;
    auto it = con_map[cn].begin();
    REP(i, 1, con_map[cn].size()) {
        auto it2 = it;
        it2++;
        ll h = (*it2 - 1) - (*it);
        ans += h * (h + 1) / 2;
        it++;
    }
    return  c[cn] * ans;
}

vll calc_sub_save(CON_NUM + 1);

ll score2(v2ll& s, vll& c, vll& t, vector<set<ll>>& con_map, int D) {
    ll ans = 0;
    vll vans(D + 1);
    vint last(CON_NUM + 1, 0);
    REP(d, 1, D + 1) {
        ans += s[d][t[d - 1]];
    }

    REP(cn, 1, CON_NUM + 1) {
        calc_sub_save[cn] = calc_sub(con_map, c, cn);
        ans -= calc_sub_save[cn];
    }
    //{
    //    last[t[d - 1]] = d;
    //    REP(i, 1, CON_NUM + 1)
    //        ans -= c[i] * (ll(d) - ll(last[i]));
    //    vans[d] = ans;
    //}
    return ans;

}

//vll add_score(v2ll& s, vll t, v2ll& com_map, int D) {
//    ll ans = 0;
//    vll vans(D + 1);
//    REP(d, 1, D + 1) {
//        ans += s[d][t[d - 1]];
//    }
//    return vans;
//}
//
//vll sub_score()

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int D;
    cin >> D;
    vll c(CON_NUM + 1);
    rep(i, CON_NUM) cin >> c[i + 1];

    v2ll s(D + 1, vll(CON_NUM + 1));
    rep(i, D) {
        rep(j, CON_NUM) cin >> s[i + 1][j + 1];
    }


    srand(time(NULL));
    vll t(D);
    vector<set<ll>> com_map(CON_NUM + 1, set<ll>());

    rep(i, CON_NUM) {
        com_map[i + 1].insert(0);
    }
    unordered_map<int, int> dt;
    rep(i, D) {
        t[i] =  distance(s[i + 1].begin(), max_element(s[i+ 1].begin(), s[i + 1].end()));
        //cin >> t[i];
        com_map[t[i]].insert(ll(i + 1));
        dt[i + 1] = t[i];
    }
    rep(i, CON_NUM) {
        com_map[i + 1].insert(D + 1);
    }
    auto ans = score2(s, c, t, com_map, D);

    //cout << ans << endl;
    //int M;
    //cin >> M;
    clock_t start = clock();
    while(1) {
        clock_t  now = clock();
        const double time = static_cast<double>(now - start) / CLOCKS_PER_SEC * 1000.0;
        if (time >1950) break;
        ll new_d, new_q;
        auto new_t = t;
        new_d = rand() % (D) +1;
        new_q = rand() % (CON_NUM)+1;
        auto new_com_map = com_map;
        auto new_dt = dt;
        ll new_ans = ans;
        int cn = dt[new_d];
        new_ans += calc_sub_save[cn]; //calc_sub(new_com_map, c, cn);
        new_ans += calc_sub_save[new_q];// calc_sub(new_com_map, c, new_q);
        new_ans -= s[new_d][cn];

        new_dt[new_d] = new_q;
        new_com_map[cn].erase(new_d);
        new_com_map[new_q].insert(new_d);
        
        new_ans += s[new_d][new_q];
        calc_sub_save[cn] = calc_sub(new_com_map, c, cn);
        new_ans -= calc_sub_save[cn];
        calc_sub_save[new_q] = calc_sub(new_com_map, c, new_q);
        new_ans -= calc_sub_save[new_q];

        new_t[new_d - 1] = new_q;
        double T = 4000000/ time;
        double prob = exp(double(min(0LL, new_ans - ans)) / T);
        if (new_ans > ans || prob > (double)rand() / RAND_MAX) {
        //if(new_ans > ans){
            com_map = new_com_map;
            dt = new_dt;
            ans = new_ans;
            t = new_t;
        }
        //cout << "prob:" << prob << endl;
        //cout << "ans:" << ans << endl;
        //cout << "score1:" << score(s, c, t, D)[D] << endl;
        //cout << "score2:" << score2(s, c, t, com_map, D) << endl;
    }
    //cout << ans << endl;
    rep(i, D) {
        cout << t[i] << endl;
    }
    //cout << score2(s, c, t, com_map, D) << endl;


    return 0;
}

Measured memory_bytes: 4380