#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;

struct Timer {
    chrono::system_clock::time_point start;
    double ms;
    Timer(double ms) : start(chrono::system_clock::now()), ms(ms) {}
    bool stop() {
        chrono::system_clock::time_point curr = chrono::system_clock::now();
        double t = static_cast<double>(chrono::duration_cast<chrono::microseconds>(curr - start).count() / 1000.0);
        return t > ms;
    }
    double partial() {
        chrono::system_clock::time_point curr = chrono::system_clock::now();
        double t = static_cast<double>(chrono::duration_cast<chrono::microseconds>(curr - start).count() / 1000.0);
        return t / ms;
    }
};

class XorShift {
    uint32_t x, y, z, w, t;

  public:
    XorShift() {
        x = 133553533;
        y = 314867339;
        z = 664298413;
        w = 999999937;
        t = 0;
    }
    // [0, 2^32)
    inline uint32_t operator()(void) {
        t = x ^ (x << 11);
        x = y;
        y = z;
        z = w;
        w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
        return w;
    }
    // [0, u)
    int operator()(int u) { return (lint(this->operator()()) * u) >> 32; }
    // [0.0, 1.0]
    double prob() { return (this->operator()() & 0xfffffff) * 3.7252903123397e-9; }
};

inline double temperature(double tmax, double tmin, double time) { return (tmax - tmin) * (1.0 - time) + tmin; }
inline double trans_prob(double diff, double temp) { return exp(diff / temp); }

template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    // temperature
    double mini, maxi;
    // cin >> mini >> maxi;
    mini = 883;
    maxi = 1612;

    int d;
    cin >> d;
    vector<lint> c(26);
    for (int i = 0; i < 26; ++i) {
        cin >> c[i];
    }
    vector<vector<lint>> s(d, vector<lint>(26));
    // lint maxi = 0;
    for (int i = 0; i < d; ++i) {
        for (int j = 0; j < 26; ++j) {
            cin >> s[i][j];
            // maxi = max(maxi, s[i][j]);
        }
    }

    Timer t(1970);
    // RandomNumberGenerator r;
    XorShift r;

    vector<lint> ret(d, 0);
    vector<lint> mx(d, -1);
    vector<lint> l(26, 0);
    for (int i = 0; i < d; ++i) {
        for (int j = 0; j < 26; ++j) {
            lint score = s[i][j] + 3 * c[j] * (i + 1 - l[j]);
            if (chmax(mx[i], score))
                ret[i] = j;
            l[ret[i]] = i + 1;
        }
    }
    vector<bitset<365>> cont(26);
    vector<bitset<365>> crev(26);
    lint score = 0;

    // l.assign(26, 0);
    for (int i = 0; i < d; ++i) {
        score += s[i][ret[i]];
        cont[ret[i]][i]         = 1;
        crev[ret[i]][d - 1 - i] = 1;
        // l[ret[i]]               = i + 1;
        for (int j = 0; j < 26; ++j) {
            if (j == ret[i])
                continue;
            // score -= c[j] * (i + 1 - l[j]);
            score -= c[j] * (crev[j]._Find_next(d - 1 - i) - (d - 1 - i));
        }
    }

    vector<vector<lint>> ss(d, vector<lint>(27, 0));
    for (int i = 0; i < d; ++i) {
        for (int j = 1; j <= 26; ++j) {
            ss[i][j] = s[i][j - 1];
            ss[i][j] += c[j] * min(d, 10);
        }
    }
    for (int i = 0; i < d; ++i) {
        for (int j = 1; j <= 26; ++j) {
            ss[i][j] += ss[i][j - 1];
        }
    }

    // cerr << score << endl;
    lint bscore       = score;
    vector<lint> bret = ret;
    lint cnt          = 0;

    while (!t.stop()) {
        double temp = temperature(maxi, mini, t.partial());
        // cerr << temp << endl;
        for (int i = 0; i < 365; ++i) {
            int idx  = i;
            int curr = ret[idx];
            // int newr = curr + r(26);
            // int newr = r(26);
            // if (newr >= 26)
            //     newr -= 26;
            lint ra  = r(ss[idx][26]);
            int newr = upper_bound(ss[idx].begin(), ss[idx].end(), ra) - 1 - ss[idx].begin();
            if (curr == newr)
                continue;
            ret[idx] = newr;
            cnt++;

            lint nscore = score;

            nscore -= s[idx][curr];
            nscore += s[idx][newr];
            lint cup = cont[curr]._Find_next(idx) - idx;
            lint cdn = crev[curr]._Find_next(d - 1 - idx) - (d - 1 - idx);
            lint nup = cont[newr]._Find_next(idx) - idx;
            lint ndn = crev[newr]._Find_next(d - 1 - idx) - (d - 1 - idx);

            nscore -= cup * cdn * c[curr];
            nscore += nup * ndn * c[newr];

            // cerr << nscore << "\n";
            // cerr << exp((nscore - score) / temp) << endl;
            if (nscore > score || trans_prob((nscore - score), temp) > r.prob()) {
                // if (nscore > score) {
                if (nscore > bscore) {
                    bscore = nscore;
                    bret   = ret;
                }
                score                   = nscore;
                cont[curr][idx]         = 0;
                crev[curr][d - 1 - idx] = 0;
                cont[newr][idx]         = 1;
                crev[newr][d - 1 - idx] = 1;
            } else { // revert
                ret[idx] = curr;
            }
        }
    }
    for (int i = 0; i < d; ++i) {
        cout << bret[i] + 1 << "\n";
    }
    // cout << bscore << endl;
    // cerr << cnt << endl;
    return 0;
}

Measured memory_bytes: 4408