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

class Timer {
public:
    void start() {
        start_ = std::chrono::steady_clock::now();
    }
    int64_t elapsedMilliSec() {
        auto n = std::chrono::steady_clock::now();
        auto e = std::chrono::duration_cast<std::chrono::milliseconds>(n - start_);
        return e.count();
    }
private:
    std::chrono::steady_clock::time_point start_;
};

constexpr int64_t NUM = 26;
vector<int64_t> c(NUM);
vector<vector<int64_t>> s;

int64_t score(const vector<int64_t>& v) {
    vector<int64_t> last(NUM, -1);
    int64_t S = 0;
    for (int64_t i = 0; i < v.size(); i++) {
        //開催による満足度増加
        S += s[i][v[i]];

        //最終開催日更新
        last[v[i]] = i;

        //開催されないことによる満足度減少
        for (int64_t j = 0; j < NUM; j++) {
            S -= c[j] * (i - last[j]);
        }
    }

    return S;
}

int main() {
    //時間関連
    Timer timer;
    timer.start();
    constexpr int64_t LIMIT_MSEC = 1900;

    //入力
    int64_t D;
    cin >> D;
    for (int64_t& C : c) {
        cin >> C;
    }

    s.resize(D, vector<int64_t>(NUM));
    for (int64_t i = 0; i < D; i++) {
        for (int64_t j = 0; j < NUM; j++) {
            cin >> s[i][j];
        }
    }

    //乱数関連
    mt19937_64 engine(0);
    uniform_int_distribution<int64_t> day_dist(0, D - 1);
    uniform_int_distribution<int64_t> num_dist(0, NUM - 1);

    //ランダムに生成
    vector<int64_t> ans(D);
    vector<int64_t> last(NUM, -1);

    for (int64_t i = 0; i < D; i++) {
        vector<int64_t> scores(NUM);
        for (int64_t j = 0; j < NUM; j++) {
            scores[j] = - c[j] * (i - last[j]);
        }
        int64_t sum = accumulate(scores.begin(), scores.end(), (int64_t)0);
        for (int64_t j = 0; j < NUM; j++) {
            scores[j] = s[i][j] + c[j] * (i - last[j]) - sum;
        }

        ans[i] = max_element(scores.begin(), scores.end()) - scores.begin();
        ans[i] = num_dist(engine);

        //最終開催日更新
        last[ans[i]] = i;
    }

    int64_t best_score = score(ans);

    while (timer.elapsedMilliSec() < LIMIT_MSEC) {
        int64_t change_day = day_dist(engine);

        //change_day日目について貪欲に変更する
        vector<int64_t> updated = ans;
        vector<int64_t> last(NUM, -1);
        for (int64_t i = 0; i < change_day; i++) {
            //最終開催日更新
            last[updated[i]] = i;
        }

        //change_dayにi番目のコンテストを開くことにした場合の改善度合い
        vector<int64_t> score_diff(NUM);
        for (int64_t i = 0; i < NUM; i++) {
            score_diff[i] = - c[i] * (change_day - last[i]);
        }
        int64_t sum = accumulate(score_diff.begin(), score_diff.end(), (int64_t)0);
        for (int64_t i = 0; i < NUM; i++) {
            score_diff[i] = s[change_day][i] + c[i] * (change_day - last[i]) - sum;
        }

        int64_t change_index = max_element(score_diff.begin(), score_diff.end()) - score_diff.begin();
        updated[change_day] = change_index;

        int64_t curr_score = score(updated);

        //スコアが改善したら採用
        if (curr_score > best_score) {
            best_score = curr_score;
            ans = updated;
        }
    }

    for (int64_t& a : ans) {
        cout << a + 1 << endl;
    }
}

Measured memory_bytes: 3732