#include <bits/stdc++.h>
#define FASTIO
using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int D;
int c[26];
int s[365][26];
int t[365];
set<int> used[26];  // コンテストが行われた日を格納
int last[26] = {};
ll ans;


void solve() {

    chrono::system_clock::time_point t_start, t_now;
    int64_t t_elapsed;
    t_start = chrono::system_clock::now();

    // 入力
    cin >> D;
    for (ll i = 0; i < 26; i++) {
        cin >> c[i];
    }
    for (ll i = 0; i < D; i++) {
        for (ll j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }

    // 貪欲
    for (ll i = 0; i < D; i++) {
        ll idx_mx = 0;
        ll mx = s[i][0];
        for (ll j = 0; j < 26; j++) {
            if (s[i][j] > mx) {
                mx = s[i][j];
                idx_mx = j;
            }
        }
        t[i] = idx_mx;
    }


    for (ll i = 0; i < 26; i++) {
        // 番兵
        used[i].emplace(-1);
        used[i].emplace(D);
    }
    for (ll i = 0; i < D; i++) {
        used[t[i]].emplace(i);
    }

    // 得点計算
    ans = 0;
    for (ll i = 0; i < D; i++) {
        ans += s[i][t[i]];
        last[t[i]] = i + 1;
        for (ll j = 0; j < 26; j++) {
            ans -= c[j] * (i + 1 - last[j]);
        }
    }

    // 焼きなまし
    random_device rd;
    mt19937 mt(rd());
    uniform_int_distribution<int> urd_i(0, 25);
    uniform_int_distribution<int> urd_d(0, D - 1);
    uniform_real_distribution<double> urd_r(0.0, 1.0);

    double temp = 500;
    double alpha = 0.999997;

    while (true) {
        int q = urd_i(mt);
        int d = urd_d(mt);
        ll ans_prev = ans;

        auto itr1 = used[t[d]].find(d);            // 前
        auto itr2 = prev(used[q].lower_bound(d));  // 後
        int pre1 = *prev(itr1);
        int nxt1 = *next(itr1);
        int pre2 = *itr2;
        int nxt2 = *next(itr2);

        ans += s[d][q] - s[d][t[d]];
        ans -= c[t[d]] * (d - pre1) * (nxt1 - d);
        ans += c[q] * (d - pre2) * (nxt2 - d);

        bool update = ans > ans_prev;
        if (!update) {
            double p = exp((double)(ans - ans_prev) / temp);
            if (urd_r(mt) <= p) {
                update = true;
            }
        }

        if (update) {
            used[t[d]].erase(itr1);
            used[q].emplace(d);
            t[d] = q;
        }
        else {
            ans = ans_prev;
        }

        t_now = chrono::system_clock::now();
        t_elapsed = chrono::duration_cast<chrono::milliseconds>(t_now - t_start).count();
        if (t_elapsed > 1980) {
            break;
        }

        temp *= alpha;
    }

    for (ll i = 0; i < D; i++) {
        cout << t[i] + 1 << "\n";
    }
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 4360