#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] = {};
int ans;
int sums = 0;

void solve() {

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

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

    // 貪欲
    for (int i = 0; i < D; i++) {
        int idx_mx = -1;
        int mx = -I_INF;
        for (int j = 0; j < 26; j++) {
            int t = s[i][j];
            for (int k = 0; k < 26; k++) {
                if (k == j) continue;
                t -= c[k] * (i + 1 - last[k]);
            }
            if (t > mx) {
                mx = t;
                idx_mx = j;
            }
        }
        last[idx_mx] = i;
        t[i] = idx_mx;
    }


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

    // 得点計算
    ans = 0;
    memset(last, 0, sizeof(last));
    for (int i = 0; i < D; i++) {
        ans += s[i][t[i]];
        last[t[i]] = i + 1;
        for (int 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 = 1000;
    double alpha = 0.9999985;
    double lb = (double)(-sums) / (D * 26) * 1.5;

    int64_t count = 0;
    int64_t count_update = 0;

    while (true) {
        int q = urd_i(mt);
        int d = urd_d(mt);
        int 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 (ans - ans_prev < lb) {
            update = false;
        }

        if (update) {
            used[t[d]].erase(itr1);
            used[q].emplace(d);
            t[d] = q;
            ++count_update;
        }
        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;
        ++count;
    }

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

    cerr << "score: " << ans << "\n";
    cerr << "temp: " << temp << "\n";
    cerr << "count: " << count << "\n";
    cerr << "update: " << count_update << "\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: 4432