#include <bits/stdc++.h>  // clang-format off
using Int = int;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Jun 28 20:59:50 JST 2020
 **/

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

std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());

template <class T, class S> T make_vec(S x) { return x; }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) {
    return std::vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...));
}

constexpr Int D = 365;
constexpr Int K = 26;
Int s[D][K], c[K];
Int sum;
constexpr double TIME_LIMIT = 1900;

const Int INF = 1e9;
Int calc_score(const std::vector<Int>& a) {
    assert(a.size() == D);
    Int ret = 0;
    Int cur_minus = 0;
    std::vector<Int> last(K, -1);
    REP(d, D) {
        cur_minus += sum - c[a[d]] * (d - last[a[d]]);
        ret += s[d][a[d]] - cur_minus;
        last[a[d]] = d;
    }
    return ret;
}

struct State {
    std::vector<Int> ans;
    std::chrono::system_clock::time_point start_time;
    Int best_score;
    State(Int x) : ans(D), start_time(std::chrono::system_clock::now()) {
        if (x == 0) {
            REP(d, D) ans[d] = d % K;
        } else {
            std::vector<Int> last(K, -1);
            REP(d, D) {
                Int ma = -1, use = -1;
                REP(k, K) {
                    Int ad = s[d][k] + c[k] * (d - last[k]);
                    if (chmax(ma, ad)) use = k;
                }
                ans[d] = use;
                last[use] = d;
            }
        }
        best_score = calc_score(ans);
    }
    std::vector<Int> local_search(Int t) {
        std::vector<Int> nxt = ans;
        if (t % 3) {
            Int dif = rnd() % 15 + 1;
            Int idx = rnd() % (D - dif);
            std::swap(nxt[idx], nxt[idx + dif]);
        } else {
            Int idx = rnd() % D;
            std::vector<Int> last(K, -1);
            REP(d, idx) last[ans[d]] = d;
            std::vector<double> p(K);
            REP(k, K) { p[k] = s[idx][k] + c[k] * (idx - last[k]); }
            std::discrete_distribution<std::size_t> dist(p.begin(), p.end());
            nxt[idx] = dist(rnd);
            // nxt[idx] = rnd() % K;
            return nxt;
        }
        return nxt;
    }
    void hill_climb(double lim) {
        double start_temp = 50, end_temp = 10;
        REP(t, 1e9) {
            std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
            double dur = std::chrono::duration_cast<std::chrono::milliseconds>(now - start_time).count();
            if (dur > lim) break;
            auto nxt = local_search(t);
            Int nxt_score = calc_score(nxt);
            double temp = start_temp + (end_temp - start_temp) * dur / lim;
            double prob = std::exp((nxt_score - best_score) / temp);
            if (nxt_score >= best_score || prob > (rnd() % INF) / (double)INF) {
                // if (nxt_score >= best_score) {
                std::cerr << t << " " << best_score << " " << nxt_score << "\n";
                best_score = nxt_score;
                ans = std::move(nxt);
            }
        }
    }
};

signed main() {
    // input
    Int _;
    std::cin >> _;
    REP(i, K) std::cin >> c[i], sum += c[i];
    REP(i, D) REP(j, K) std::cin >> s[i][j];

    // local search
    Int best = -INF;
    std::vector<Int> ans;
    constexpr Int times = 4;
    REP(x, times) {
        State st(x);
        st.hill_climb(TIME_LIMIT / times);
        if (chmax(best, st.best_score)) std::swap(ans, st.ans);
    }

    // output
    for (Int x : ans) std::cout << x + 1 << "\n";
    std::cout << std::endl;
    std::cerr << best << std::endl;
}


Measured memory_bytes: 4336