#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int ALP_NUM = 26;
const int INF = 1001001001;
const int TL = 1900;

const double T0 = 2e3;
const double T1 = 6e1;

int main() {
    int d;
    cin >> d;
    vector<int> C(ALP_NUM);
    rep(i, ALP_NUM) cin >> C[i];
    vector<vector<int>> S(d, vector<int>(ALP_NUM));
    rep(i, d) rep(j, ALP_NUM) cin >> S[i][j];
    vector<int> T;
    vector<set<int>> schedules(ALP_NUM);
    rep(i, ALP_NUM) schedules[i].insert(-1);

    vector<int> best_T;
    int best = 0, score_mem = 0;

    auto get_score = [&](vector<int> A, int n) {
        int res = 0;
        vector<int> D(ALP_NUM, -1);
        n = min(d, n);
        rep(i, n) {
            int t = A[i];
            if (t >= 0) {
                res += S[i][t];
                D[t] = i;
            }
            rep(j, ALP_NUM) {
                res -= (i-D[j]) * C[j];
            }
        }
        return res;
    };

    auto change = [&](int nd, int nt) {
        int pt = T[nd];
        int res = S[nd][nt] - S[nd][pt];

        auto it_l = schedules[pt].lower_bound(nd);
        auto it_r = schedules[pt].upper_bound(nd);
        --it_l;
        int pt_ld = *it_l;
        int pt_rd;
        if (it_r != schedules[pt].end()) pt_rd = *it_r;
        else pt_rd = d;
        res -= C[pt] * (nd-pt_ld) * (pt_rd-nd);

        it_l = schedules[nt].lower_bound(nd);
        it_r = schedules[nt].upper_bound(nd);
        --it_l;
        int nt_ld = *it_l;
        int nt_rd;
        if (it_r != schedules[nt].end()) nt_rd = *it_r;
        else nt_rd = d;
        res += C[nt] * (nd-nt_ld) * (nt_rd-nd);

        return res;
    };

    random_device rnd;
    mt19937 mt(rnd());
    uniform_int_distribution<> rand_alp(0, ALP_NUM-1);
    uniform_int_distribution<> rand_day(0, d-1);
    uniform_int_distribution<> rand_swap(0, 1);
    uniform_int_distribution<> rand_T(0, 10000);

    rep(i, d) {
        T.emplace_back(rand_alp(mt));
        schedules[T[i]].insert(i);
    }

    auto swap = [&](int d1, int d2, int T_) {
        int t1 = T[d1], t2 = T[d2];
        int diff = change(d1, t2);
        T[d1] = t2;
        schedules[t1].erase(d1);
        schedules[t2].insert(d1);
        diff += change(d2, t1);
        if (diff > 0 || int(exp(double(diff)/T_)*10000) > rand_T(mt)) {
            T[d2] = t1;
            schedules[t2].erase(d2);
            schedules[t1].insert(d2);
            score_mem += diff;
        } else {
            T[d1] = t1;
            schedules[t2].erase(d1);
            schedules[t1].insert(d1);
        }
    };
    
    auto start = std::chrono::system_clock::now(); 
    auto end = std::chrono::system_clock::now();
    auto dur = end - start;
    auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(dur).count();
    
    int cnt = 0;
    double t = 0.0;
    double T_ = T0;
    
    while (msec < TL) {
        ++cnt;
        if (rand_swap(mt)) {
            int d1 = rand_day(mt);
            int d2 = rand_day(mt);
            swap(d1, d2, T_);
        } else {
            int nd = rand_day(mt);
            int nt = rand_alp(mt);
            int diff = change(nd, nt);
            if (diff > 0 || int(exp(double(diff)/T_)*10000) > rand_T(mt)) {
                int old = T[nd];
                T[nd] = nt;
                schedules[old].erase(nd);
                schedules[nt].insert(nd);
                score_mem += diff;
            }
        }
        if (score_mem > best) {
            best = score_mem;
            best_T = T;
        }
        if (cnt % 1000 == 0) {
            end = std::chrono::system_clock::now();
            dur = end - start;
            msec = std::chrono::duration_cast<std::chrono::milliseconds>(dur).count();
            t = msec / TL;
            T_ = pow(T0, 1-t) * pow(T1, t);
        }
    }

    rep(i, d) {
        cout << best_T[i]+1 << endl;
    }

    //cout << get_score(best_T, d) << endl;
    //cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 4140