#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
#include <random>

using namespace std;

typedef signed long long ll;
typedef vector<int> vec;
const int TP = 26;

ll compute_score(int D, vector<int>& C, vector<vector<int>>& S, vector<int>& sol) {
    vector<int> last(TP, 0);
    ll score = 0;
    for (int i = 0; i < D; i++) {
        int j = sol[i];
        last[j] = i + 1;
        int tmp = 0;
        for (int k = 0; k < TP; k++)
            tmp -= C[k] * (i + 1 - last[k]);
        score += S[i][j] + tmp;
    }
    return score;
}

void compute_greedy_with_pen(int D, vector<int>& C, vector<vector<int>>& S, vector<int>* sol, double gamma) {
    vector<int> last(TP, 0);
    for (int i = 0; i < D; i++) {
        vector<double> scores(TP, 0.0);
        for (int k = 0; k < TP; k++) {
            scores[k] = S[i][k] + gamma * (i + 1 - last[k]) * C[k];
        }
        auto itp = std::max_element(scores.begin(), scores.end());
        int di = itp - scores.begin();
        last[di] = i + 1;
        (*sol)[i] = di;
    }
}

int main() {
    int D; cin >> D;
    vector<int> C(TP, 0);
    for (int i = 0; i < TP; i++) cin >> C[i];
    vector<vector<int>> S(D, vector<int>(TP, 0));
    for (int i = 0; i < D; i++)
        for (int j = 0; j < TP; j++)
            cin >> S[i][j];

    // greedy解の周辺を探索
    auto start = std::chrono::system_clock::now();
    vector<int> sol(D, 0);
    vector<int> sol_best(D, 0);
    double gamma = 1.0;
    compute_greedy_with_pen(D, C, S, &sol, gamma);
    gamma += 1.0;
    for (int k = 0; k < D; k++) { sol_best[k] = sol[k]; }
    ll score_best = compute_score(D, C, S, sol);
    while (true) {
        compute_greedy_with_pen(D, C, S, &sol, gamma);
        ll score = compute_score(D, C, S, sol);
        if (score > score_best) {
            for (int k = 0; k < D; k++) { sol_best[k] = sol[k]; }
            score_best = score;
        }
        auto end = std::chrono::system_clock::now();
        double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
        if (elapsed >= 900)
            break;
        gamma += 1.0;
    }

    // 残り1000秒ローカルサーチ
    std::random_device r;
    std::default_random_engine e1(r());
    std::uniform_int_distribution<int> ud1(0, D);
    std::uniform_int_distribution<int> ud2(0, TP);
    while (true) {
        // ランダムに1日選択
        int di = ud1(e1);
        int gi = ud2(e1);

        vector<int> nsol(D, 0);
        for (int k = 0; k < D; k++) { nsol[k] = sol_best[k]; }
        nsol[di] = gi;
        ll score = compute_score(D, C, S, nsol);
        if (score > score_best) {
            for (int k = 0; k < D; k++) { sol_best[k] = nsol[k]; }
            score_best = score;
        }

        auto end = std::chrono::system_clock::now();
        double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
        // cout << elapsed << " " << score << " " << score_best << endl;
        if (elapsed >= 1800) {
            for (auto v : sol_best) { cout << (v  + 1) << endl; }
            exit(0);
            break;
        }
    }

    // for (auto v : sol_best) { cout << (v  + 1) << endl; }
}

Measured memory_bytes: 3668