#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;
    int ms;
    Timer(int 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;
    }
    int 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 1000 * t / ms;
    }
};

using ulint = unsigned long long;
struct RandomNumberGenerator {
    mt19937_64 mt;
    RandomNumberGenerator() : mt(chrono::steady_clock::now().time_since_epoch().count()) {}
    ulint operator()(ulint a, ulint b) { // [a, b)
        uniform_int_distribution<ulint> dist(a, b - 1);
        return dist(mt);
    }
    ulint operator()(ulint b) { // [0, b)
        return (*this)(0, b);
    }
    ulint operator()() { return mt(); }
};

class XorShift {
    unsigned int x, y, z, w, t;

  public:
    XorShift() {
        x = 133553533;
        y = 314867339;
        z = 664298413;
        w = 999999937;
        t = 0;
    }
    unsigned int rand() {
        t = x ^ (x << 11);
        x = y;
        y = z;
        z = w;
        w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
        return w & 0x7fffffff;
    }
    unsigned int operator()(int u) {
        t = x ^ (x << 11);
        x = y;
        y = z;
        z = w;
        w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
        return (w & 0x7fffffff) % u;
    }
    static unsigned int max() { return 0x7fffffff; }
};

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);
    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] + 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, 26);
        }
    }
    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;

    lint maxi = 3000;
    lint mini = 300;

    while (!t.stop()) {
        double p    = t.partial(); // 0 - 1000
        double temp = double(maxi - mini) * (double(1000) - p) / double(1000) + mini;
        // 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 -= c[curr] * (cup + cdn - 1) * (cup + cdn) / 2;
            // nscore += c[curr] * (cup - 1) * cup / 2;
            // nscore += c[curr] * (cdn - 1) * cdn / 2;
            // nscore += c[newr] * (nup + ndn - 1) * (nup + ndn) / 2;
            // nscore -= c[newr] * (nup - 1) * nup / 2;
            // nscore -= c[newr] * (ndn - 1) * ndn / 2;

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

            // cerr << nscore << "\n";
            // cerr << exp((nscore - score) / temp) << endl;
            if (nscore > score || exp((nscore - score) / temp) > (double)r.rand() / double(r.max())) {
                // 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";
    }
    cerr << bscore << endl;
    cerr << cnt << endl;
    return 0;
}

Measured memory_bytes: 4344