#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

const int D = 365;
vector<int> c(26);
vector<vector<int>> s(D, vector<int>(26));

struct State {
    vector<int> contest;
    vector<ll> scores;
    ll score = -1e10;
    int type, day, old_i, new_i, day1, old_i1, new_i1, day2, old_i2, new_i2;

    vector<vector<int>> days;

    State() {
        contest.resize(D);
        scores.resize(26);
        days.resize(26);
    }

    void move() {
        type = rng.next_int(2);
        if (type == 0) {
            // pick a day and change the contest type
            day = rng.next_int(D);
            old_i = contest[day];
            new_i = rng.next_int(26);
            change_contest(day, new_i);
        } else {
            // swap two days
            day1 = rng.next_int(D);
            day2 = rng.next_int(D);
            old_i1 = new_i2 = contest[day1];
            new_i1 = old_i2 = contest[day2];
            change_contest(day1, new_i1);
            change_contest(day2, new_i2);
        }
    }

    void move_back() {
        if (type == 0) {
            change_contest(day, old_i);
        } else {
            change_contest(day1, old_i1);
            change_contest(day2, old_i2);
        }
    }

    ll calc_cost(int d1, int d2) {
        int d = d2 - d1;
        return d * (d - 1) / 2;
    }

    ll calc_score() {
        REP(i, 26) days[i].clear();
        REP(d, D) {
            days[contest[d]].push_back(d);
        }

        vector<int> last(26, -1);
        score = 1e6;
        REP(d, D) {
            int j = contest[d];
            last[j] = d;
            REP(i, 26) {
                score -= (d - last[i]) * c[i];
            }
            score += s[d][j];
        }
        return score;
    }

    void change_contest(int day, int new_i) {
        int old_i = contest[day];
        int p = lower_bound(ALL(days[old_i]), day) - days[old_i].begin();
        int prev = (p > 0 ? days[old_i][p-1] : -1);
        int next = (p < days[old_i].size() - 1 ? days[old_i][p+1] : D);
        days[old_i].erase(days[old_i].begin() + p);
        score += (calc_cost(prev, day) + calc_cost(day, next) - calc_cost(prev, next)) * c[old_i];

        p = lower_bound(ALL(days[new_i]), day) - days[new_i].begin();
        prev = (p > 0 ? days[new_i][p-1] : -1);
        next = (p < days[new_i].size() ? days[new_i][p] : D);
        days[new_i].insert(days[new_i].begin() + p, day);
        score -= (calc_cost(prev, day) + calc_cost(day, next) - calc_cost(prev, next)) * c[new_i];

        score += s[day][new_i] - s[day][old_i];
        contest[day] = new_i;
    }
};

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);
}

State simulated_annealing(State& beginning_state, ll duration) {

    double temp_start = 2e3;
    double temp_end = 6e2;
    double temperature = temp_start;

    State cur_state = beginning_state;
    State best_state = cur_state;
    int iter = 0;
    ll cur_time = 0;
    timer.start();

    while (true) {
        if (iter % 100 == 0) {
            cur_time = timer.get_time();
            if (cur_time > duration) break;
            double t = (double) cur_time / duration;
            temperature = pow(temp_start, 1 - t) * pow(temp_end, t);
        }

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

        ll prev_score = cur_state.score;
        cur_state.move();

        if (accept(prev_score, cur_state.score, temperature) > rng.next_double()) {
            if (cur_state.score > best_state.score) {
                best_state = cur_state;
            }
        } else {
            cur_state.move_back();
        }

        iter++;
    }

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

    return best_state;
}

State greedy() {
    State best_state;
    for (int factor = 1; factor <= 5; factor++) {
        vector<int> last(26, -1);
        State state;
        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;
            state.contest[d] = j;
        }
        state.calc_score();
        if (state.score > best_state.score) {
            best_state = state;
        }
    }
    return best_state;
}

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];

    State state = greedy();
    state = simulated_annealing(state, 1950);

    REP(d, D) cout << state.contest[d] + 1 << endl;
}

Measured memory_bytes: 4484