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

uint64_t rnd() {
    static uint64_t x = 88172645463325252ULL;
    x = x ^ (x << 7);
    return x = x ^ (x >> 9);
}

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

struct State {
    Int a[D];
    Int score;
    Int calc_score() const {
        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;
    }
    void initialize() {
        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;
            }
            a[d] = use;
            last[use] = d;
        }
        score = calc_score();
    }
    State modify(Int t) const {
        State ret = *this;
        if (t % 2) {
            Int dif = rnd() % 15 + 1;
            Int idx = rnd() % (D - dif);
            std::swap(ret.a[idx], ret.a[idx + dif]);
        } else {
            Int idx = rnd() % D;
            ret.a[idx] = rnd() % K;
        }
        ret.score = ret.calc_score();
        return ret;
    }
};

struct Annealing {
    const Int INF = 1e9;
    const double start_temp, end_temp;
    State cur;
    std::chrono::system_clock::time_point start_time;
    Annealing(Int x, double start_temp_ = 50, double end_temp_ = 10)
        : start_temp(start_temp_), end_temp(end_temp_), start_time(std::chrono::system_clock::now()) {
        cur.initialize();
    }
    void run(double lim) {
        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;
            State nxt = cur.modify(t);
            double temp = start_temp + (end_temp - start_temp) * dur / lim;
            double prob = std::exp((nxt.score - cur.score) / temp);
            if (nxt.score >= cur.score || prob > (rnd() % INF) / (double)INF) {
                std::cerr << t << " " << cur.score << " " << nxt.score << "\n";
                cur = std::move(nxt);
            }
        }
    }
};

Int solve() {
    // input
    Int _;
    std::cin >> _;
    sum = 0;
    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 = -1e9;
    State ans;
    constexpr Int times = 2;
    REP(x, times) {
        Annealing an(x, 1000, 10);
        an.run(TIME_LIMIT / times);
        if (chmax(best, an.cur.score)) std::swap(ans, an.cur);
    }

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

signed main() {
#ifdef LOCAL
    Int T = 10;
    Int score = 0;
    REP(i, T) {
        std::string filename = "data/";
        filename += ('0' + i);
        filename += ".txt";
        std::ifstream in(filename);
        std::cin.rdbuf(in.rdbuf());
        score += std::max(0, solve());
    }
    std::cerr << "sum : " << score << std::endl;
#else
    solve();
#endif
}


Measured memory_bytes: 4324