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

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

struct State {
    std::array<Int, D> a;
    Int score = 0;
    State() {}
    Int calc_score(Int D_ = D) 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 generate_neighbor(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;
    }
};

std::vector<State> beam_search(Int width = 3) {
    // {score, state}
    std::vector<State> states = {State()};
    REP(d, D) {
        std::vector<State> nxts;
        REP(k, K) {
            for (State state : states) {
                state.a[d] = k;
                state.score = state.calc_score(d + 1);
                nxts.push_back(state);
                std::sort(nxts.begin(), nxts.end(), [](State& a, State& b) { return a.score > b.score; });
                if (nxts.size() > width) nxts.pop_back();
            }
        }
        std::swap(states, nxts);
    }
    return states;
}

struct Annealing {
    const Int INF = 1e9;
    State cur;
    const double start_temp, end_temp;
    std::chrono::system_clock::time_point start_time;
    Annealing(State state, double start_temp_ = 50, double end_temp_ = 10)
        : cur(state), start_temp(start_temp_), end_temp(end_temp_), start_time(std::chrono::system_clock::now()) {}
    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.generate_neighbor(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;
    std::vector<State> cans = beam_search(20);
    State ans;
    constexpr Int times = 5;
    REP(x, times) {
        Annealing an(cans[x], 500, 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: 3804