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

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

    Timer t(1950);
    RandomNumberGenerator r;

    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]);
        }
    }
    vector<lint> ret(d, -1);
    vector<lint> mx(d, -1);
    for (int i = 0; i < d; ++i) {
        for (int j = 0; j < 26; ++j) {
            if (chmax(mx[i], s[i][j]))
                ret[i] = j;
        }
    }
    lint score = 0;
    vector<lint> last(26, 0);
    vector<lint> sc(26, 0);
    for (int i = 0; i < d; ++i) {
        sc[ret[i]] += s[i][ret[i]];
        last[ret[i]] = i + 1;
        for (int j = 0; j < 26; ++j) {
            sc[j] -= c[j] * (i + 1 - last[j]);
        }
    }

    for (int i = 0; i < 26; ++i) {
        score += sc[i];
    }
    // cerr << score << endl;
    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];
        }
    }
    for (int i = 0; i < d; ++i) {
        for (int j = 1; j <= 26; ++j) {
            ss[i][j] += ss[i][j - 1];
        }
    }

    while (!t.stop()) {
        int p       = t.partial(); // 0 - 1000
        double temp = double(maxi) * (1000 - p) / 1000;
        // bool swap = 1000 - p > rand;
        // cerr << 1000 - p << " " << rand << endl;
        for (int i = 0; i < 100; ++i) {
            int idx  = r(d);
            int curr = ret[idx];
            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;

            lint nscore = score;

            lint scurr = sc[curr];
            lint snew  = sc[newr];

            nscore -= scurr + snew;
            sc[curr] = 0;
            sc[newr] = 0;

            vector<lint> last(2, 0);
            for (int i = 0; i < d; ++i) {
                if (ret[i] == curr) {
                    sc[curr] += s[i][curr];
                    last[0] = i + 1;
                } else if (ret[i] == newr) {
                    sc[newr] += s[i][newr];
                    last[1] = i + 1;
                }
                sc[curr] -= c[curr] * (i + 1 - last[0]);
                sc[newr] -= c[newr] * (i + 1 - last[1]);
            }
            nscore += sc[curr] + sc[newr];

            // cerr << nscore << "\n";
            if (nscore > score || exp((nscore - score) / temp) * 1000 > r(1000)) {
                score = nscore;
            } else { // revert
                ret[idx] = curr;
                sc[curr] = scurr;
                sc[newr] = snew;
            }
        }
    }
    cerr << score << endl;
    for (int i = 0; i < d; ++i) {
        cout << ret[i] + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 4452