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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

struct XorShift {
    uint32_t x = 123456789;
    uint32_t y = 362436069;
    uint32_t z = 521288629;
    uint32_t w = 88675123;
    double urand(void) noexcept {
        uint32_t t;
        t = x ^ (x << 11);
        x = y;
        y = z;
        z = w;
        w ^= t ^ (t >> 8) ^ (w >> 19);
        return w / 4294967296.0;
    }
    int randint(int a, int b) noexcept {
        return static_cast<int>(urand() * (b - a + 1)) + a;
    }
};

int D;
int c[26];
int s[365][26];
int t[365];
set<int> used[26];  // コンテストが行われた日を格納
int last[26] = {};
int ans;
int sums = 0;

void solve() {

    chrono::system_clock::time_point t_start, t_now;
    int64_t t_elapsed;
    t_start = chrono::system_clock::now();

    // 入力
    cin >> D;
    for (int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    for (int i = 0; i < D; i++) {
        for (int j = 0; j < 26; j++) {
            cin >> s[i][j];
            sums += s[i][j];
        }
    }

    // 貪欲
    for (int i = 0; i < D; i++) {
        int idx_mx = -1;
        int mx = -I_INF;
        for (int j = 0; j < 26; j++) {
            int t = s[i][j];
            for (int k = 0; k < 26; k++) {
                if (k == j) continue;
                t -= c[k] * (i + 1 - last[k]);
            }
            if (t > mx) {
                mx = t;
                idx_mx = j;
            }
        }
        last[idx_mx] = i;
        t[i] = idx_mx;
    }


    for (int i = 0; i < 26; i++) {
        // 番兵
        used[i].emplace(-1);
        used[i].emplace(D);
    }
    for (int i = 0; i < D; i++) {
        used[t[i]].emplace(i);
    }

    // 得点計算
    ans = 0;
    memset(last, 0, sizeof(last));
    for (int i = 0; i < D; i++) {
        ans += s[i][t[i]];
        last[t[i]] = i + 1;
        for (int j = 0; j < 26; j++) {
            ans -= c[j] * (i + 1 - last[j]);
        }
    }

    // 焼きなまし
    XorShift xorshift;

    double temp = 2000;
    double alpha = 0.9999995;
    double lb = (double)(-sums) / (D * 26) * 1.0;

    int64_t count = 0;
    int64_t count_update = 0;

    int itobs = 0;
    int ntobs = 10000;

    while (true) {
        int q = xorshift.randint(0, 25);
        int d = xorshift.randint(0, 364);

        if (t[d] != q) {
            int ans_prev = ans;

            auto itr1 = used[t[d]].find(d);            // 前
            auto itr2 = prev(used[q].lower_bound(d));  // 後
            int pre1 = *prev(itr1);
            int nxt1 = *next(itr1);
            int pre2 = *itr2;
            int nxt2 = *next(itr2);

            ans += s[d][q] - s[d][t[d]];
            ans -= c[t[d]] * (d - pre1) * (nxt1 - d);
            ans += c[q] * (d - pre2) * (nxt2 - d);

            bool update = ans > ans_prev;
            if (!update) {
                double p = exp((double)(ans - ans_prev) / temp);
                if (xorshift.urand() <= p) {
                    update = true;
                }
            }

            if (ans - ans_prev < lb) {
                update = false;
            }

            if (update) {
                used[t[d]].erase(itr1);
                used[q].emplace(d);
                t[d] = q;
                ++count_update;
            }
            else {
                ans = ans_prev;
            }
        }

        temp *= alpha;
        ++count;
        ++itobs;

        if (itobs == ntobs) {
            itobs = 0;
            t_now = chrono::system_clock::now();
            t_elapsed = chrono::duration_cast<chrono::milliseconds>(t_now - t_start).count();
            if (t_elapsed > 1980) {
                break;
            }
        }
    }

    for (int i = 0; i < D; i++) {
        cout << t[i] + 1 << "\n";
    }

    // 得点計算
    int score = 0;
    memset(last, 0, sizeof(last));
    for (int i = 0; i < D; i++) {
        score += s[i][t[i]];
        last[t[i]] = i + 1;
        for (int j = 0; j < 26; j++) {
            score -= c[j] * (i + 1 - last[j]);
        }
    }

    cerr << "score: " << ans << " (" << score << ")\n";
    cerr << "temp: " << temp << "\n";
    cerr << "count: " << count << "\n";
    cerr << "update: " << count_update << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 4484