#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

int D;
vector<int> c;
vector<vector<int>> s;
vector<int> solution;
vector<int> last(26);
vector<ll> type_score(26);

unsigned int xor128() {
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t;
    t = x ^ (x << 11);
    x = y; y = z; z = w;
    return w = w ^ (w >> 19) ^ (t ^ (t >> 8));
}

ll evaluate(vector<int>& sol) {
    fill(ALL(last), 0);
    fill(ALL(type_score), 0);

    REP(d, D) {
        int j = sol[d] - 1;
        last[j] = d + 1;
        REP(i, 26) {
            type_score[i] -= (d + 1 - last[i]) * c[i];
        }
        type_score[j] += s[d][j];
    }


    ll score = 1e6;
    REP(i, 26) score += type_score[i];

    return max(score, 0ll);
}

// ll evaluate_change(vector<int>& sol, int a, int b) {
//     a--; b--;
//     last[a] = last[b] = 0;
//     type_score[a] = type_score[b] = 0;

//     REP(d, D) {
//         int j = sol[d] - 1;
//         if (j == a || j == b) {
//             last[j] = d + 1;
//             type_score[j] += s[d][j];
//         }
//         type_score[a] -= (d + 1 - last[a]) * c[a];
//         type_score[b] -= (d + 1 - last[b]) * c[b];
//     }

//     ll score = 1e6;
//     REP(i, 26) score += type_score[i];

//     return max(score, 0ll);
// }

void simulated_annealing() {

    auto begin_time = chrono::steady_clock::now();
    auto cur_time = begin_time;
    ll time_elapsed = 0;
    const ll DURATION = 1900;

    double temperature = 1;

    vector<int> cur_state = solution;

    ll cur_score = evaluate(cur_state);
    ll best_score = cur_score;

    int iter = 0;

    while (true) {
        // check the time and update the temperature
        if (iter % 100 == 0) {
            cur_time = chrono::steady_clock::now();
            time_elapsed = chrono::duration_cast<chrono::milliseconds>(cur_time - begin_time).count();
            if (time_elapsed > DURATION) break;
            temperature = (double) (DURATION - time_elapsed) / DURATION;
        }

        // get the next state
        int type = xor128() % 2;
        int d, i, j, d1, d2;
        if (type == 0) {
            // pick a day and change it to other type
            d = xor128() % D;
            i = cur_state[d];
            j = xor128() % 26 + 1;
            cur_state[d] = j;
        } else {
            // swap
            d1 = xor128() % D;
            d2 = xor128() % D;
            swap(cur_state[d1], cur_state[d2]);
        }


        // calculate the score of the next state
        ll next_score = evaluate(cur_state);
        // ll next_score = evaluate_change(cur_state, i, j);

        // if the score improved or force_next is true, set the neighbor as the current node
        const ll R = 10000;
        // bool force_next = temperature > (double) (xor128() % R) / R;
        // if (time_elapsed < 1000) force_next = false;
        const bool force_next = false;

        if (next_score > cur_score || force_next) {
            cur_score = next_score;
        } else {
            // roll back the change
            if (type == 0) {
                cur_state[d] = i;
            } else {
                swap(cur_state[d1], cur_state[d2]);
            }
        }

        // save the best state
        if (cur_score > best_score) {
            solution = cur_state;
            best_score = cur_score;
        }

        iter++;
    }

    cerr << "Time elapsed: " << time_elapsed << endl;
    cerr << "Iterations: " << iter << endl;
}

void greedy() {
    fill(ALL(last), 0);

    for (int d = 0; d < D; d++) {
        int j = 0, score = 0;
        for (int i = 0; i < 26; i++) {
            int nscore = s[d][i] + (d - last[i]) * c[i] * 5;
            if (nscore > score) {
                j = i;
                score = nscore;
            }
        }
        last[j] = d + 1;
        solution[d] = j + 1;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> D;
    c.resize(26);
    REP(i, 26) cin >> c[i];
    s.resize(D, vector<int>(26));
    REP(i, D) REP(j, 26) cin >> s[i][j];
    solution.resize(D);

    greedy();
    simulated_annealing();
    // cerr << evaluate(solution) << endl;
    // cerr << evaluate_change(solution, 1, 2) << endl;

    REP(d, D) cout << solution[d] << endl;
}

Measured memory_bytes: 3672