#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <bitset>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <functional>
#include <stack>
#include <cmath>
#include <string>
#include <chrono>

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()

// A random number generator using Xorshift128
struct Random {
    unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;

    unsigned int xorshift() {
        unsigned int t;
        t = x ^ (x << 11);
        x = y; y = z; z = w;
        return w = w ^ (w >> 19) ^ (t ^ (t >> 8));
    }

    // returns a random integer in the range [0, n)
    int next_int(int n) {
        return xorshift() % n;
    }

    // returns a random double number in the range [0, 1)
    double next_double() {
        return xorshift() * (1.0 / 0xFFFFFFFFu);
    }
} rng;

struct Timer {
    chrono::steady_clock::time_point start_time;

    void start() {
        start_time = chrono::steady_clock::now();
    }

    long long get_time() {
        auto cur_time = chrono::steady_clock::now();
        return chrono::duration_cast<chrono::milliseconds>(cur_time - start_time).count();
    }
} timer;

/***************************************************************
 * CODE BELOW
 ***************************************************************/

#define DEBUG

int D = 365;
vector<int> c(26);
vector<vector<int>> s(D, vector<int>(26));
vector<int> best_state(D);
ll best_score = -1;
vector<ll> scores(26);

ll calc_contest_score(const vector<int>& sol, int i) {
    int last = 0;
    scores[i] = 0;
    REP(d, D) {
        if (i == sol[d]) {
            scores[i] += s[d][i];
            last = d + 1;
        }
        scores[i] -= (d + 1 - last) * c[i];
    }
    return scores[i];
}

ll calc_score(const vector<int>& sol) {
    ll score = 1e6;
    REP(i, 26) score += calc_contest_score(sol, i);
    return max(score, 0ll);
}

double accept(ll prev_score, ll cur_score, double temperature) {
    if (prev_score < cur_score) return 1.0;
    return exp((double) (cur_score - prev_score) / temperature);
}

void simulated_annealing(ll duration) {

    double temperature = 2e3;
    double decay_rate = 1e-5;

    vector<int> cur_state = best_state;

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

    int iter = 0;
    timer.start();

    while (timer.get_time() < duration) {

        #ifdef DEBUG
        if (iter % 50000 == 0) cerr << temperature << endl;
        #endif

        // get the next state
        int type = rng.next_int(2);
        int i, j, d, d1, d2;
        if (type == 0) {
            // pick a day and change the contest type
            d = rng.next_int(D);
            i = cur_state[d];
            j = rng.next_int(26);
            cur_state[d] = j;
        } else {
            // swap two days
            d1 = rng.next_int(D);
            d2 = rng.next_int(D);
            i = cur_state[d1];
            j = cur_state[d2];
            swap(cur_state[d1], cur_state[d2]);
        }

        // calculate the score of the next state
        ll prevscore_i = scores[i], prevscore_j = scores[j];
        ll next_score = cur_score;
        next_score -= prevscore_i + prevscore_j;
        next_score += calc_contest_score(cur_state, i) + calc_contest_score(cur_state, j);

        if (accept(cur_score, next_score, temperature) > rng.next_double()) {
            cur_score = next_score;

            // save the best state
            if (cur_score > best_score) {
                best_state = cur_state;
                best_score = cur_score;
            }
        } else {
            // roll back the change
            scores[i] = prevscore_i;
            scores[j] = prevscore_j;
            if (type == 0) {
                cur_state[d] = i;
            } else {
                swap(cur_state[d1], cur_state[d2]);
            }
        }

        iter++;
        temperature *= 1.0 - decay_rate;
    }

    #ifdef DEBUG
    cerr << "Iterations: " << iter << endl;
    #endif
}

vector<int> greedy(int factor) {
    vector<int> last(26);
    vector<int> solution(D);
    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] * factor;
            if (nscore > score) {
                j = i;
                score = nscore;
            }
        }
        last[j] = d + 1;
        solution[d] = j;
    }
    return solution;
}

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

    int _D;
    cin >> _D;
    REP(i, 26) cin >> c[i];
    REP(i, D) REP(j, 26) cin >> s[i][j];

    for (int i = 1; i < 5; i++) {
        auto new_state = greedy(i);
        ll new_score = calc_score(new_state);
        if (new_score > best_score) {
            best_state = new_state;
            best_score = new_score;
        }
    }

    simulated_annealing(1950);

    REP(d, D) cout << best_state[d] + 1 << endl;
}

Measured memory_bytes: 4500