// May this submission get accepted
#include <bits/stdc++.h>

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using namespace std;

// AtCoder/Codeforces 用 デバッグ検知
#ifdef ONLINE_JUDGE
constexpr bool DEBUG_MODE = false;
#else
constexpr bool DEBUG_MODE = true;
#endif

// エイリアス (補完・コンパイルが重くなる)
// #include <boost/multiprecision/cpp_int.hpp>
// using mll = boost::multiprecision::cpp_int;

// 汎用マクロ
#define ALLOF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define FOREACH(i,q) for (auto &i : q)
template<typename T, typename U> bool chmax(T &a, const U b) { if (a < b) {a = b; return true;} return false; }
template<typename T, typename U> bool chmin(T &a, const U b) { if (a > b) {a = b; return true;} return false; }
constexpr int INF = numeric_limits<int>::max();
constexpr long long LINF = numeric_limits<long long>::max();
constexpr long double EPS = 1e-10L;
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define IIF(q,t,f) ((q) ? (t) : (f))
#define DUMP(q) DUMP_FUNC(q, #q, __FILE__, __LINE__)
template <typename T> void DUMP_PROC(T x) { if (is_integral<T>() || is_floating_point<T>()) cerr << "\e[32m" << x << "\e[m"; else cerr << x; }
template<> void DUMP_PROC<char>(char x) { cerr << "\e[36m\'" << x << "\'\e[m"; }
template<> void DUMP_PROC<string>(string x) { cerr << "\e[33m\"" << x << "\"\e[m"; }
template <typename T, typename U> void DUMP_PROC(pair<T, U> x) { cerr << "{"; DUMP_PROC(x.first); cerr << ", "; DUMP_PROC(x.second); cerr << "}"; }
template <typename ...T, typename U, U... Seq> void DUMP_PROC(tuple<T...> &x, integer_sequence<U, Seq...>) { (void)(int[]){(cerr << ((const char*[]){"", ", "})[!!Seq] << (DUMP_PROC(get<Seq>(x)), ""), 0)...}; }
template <typename ...T> void DUMP_PROC(tuple<T...> x) {cerr << "{"; DUMP_PROC(x, index_sequence_for<T...>()); cerr << "}";}
template <typename T> void DUMP_PROC(vector<T> x) { cerr << "["; for (auto &xi : x) { DUMP_PROC(xi); cerr << (&xi != &*x.rbegin()?", ":""); } cerr << "]"; }
template <typename T> void DUMP_FUNC(T x, const char* name, const char* fn, int ln) { cerr << "\e[32m[DEBUG]\e[m " << name << ": "; DUMP_PROC(x); cerr << " @ " << fn << "(" << ln << ")" << endl; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// 標準入出力
struct qin { // query input
    size_t sz;
    qin(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
qin in1; // input one
template <typename T> void say(const T x, const char* end = "\n") { cout << x << end; }
void say(const ld x, const char* end = "\n") { cout << setprecision(30) << x << end; }
template <typename T> void say(const vector<T> x, const char* sep = " ", const char* end = "\n") { REP(i, x.size()) { cout << x[i] << (i+1 == i_len ? end : sep); } }
template <typename T> void say(const vector<vector<T>> x, const char* sep = " ", const char* end = "\n") { REP(i, x.size()) { say(x[i], sep, end); } }

// モジュール
// [[LIBRARY]] marathon.cpp xor128.cpp
// [Inclusion] xor128.cpp
// XORShift 擬似乱数発生器
inline uint32_t xor128(void){
    static uint32_t x = 123456789;
    static uint32_t y = 362436069;
    static uint32_t z = 521288629;
    static uint32_t w = 88675123; 
    uint32_t t;

    t = x ^ (x << 11);
    x = y; y = z; z = w;
    return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));  
}
inline double rand_uniform(void) { return (double)xor128() / 0x100000000LL; }
template <typename T>
inline T rand_range(T min, T max) { return min + xor128() % (max - min + 1); }
inline bool rand_prob(double p) { return rand_uniform() < p; }

// [Inclusion] marathon.cpp
// 依存関係じゃないけどよほどでなければ一緒に使うのでxor128.cppを入れる
// マラソン用モジュール
namespace marathon {
    clock_t start_clock;
    constexpr double time_limit = 2; // 実行時間[s]より0.1ms程度余裕をあける
    constexpr double time_limit_inv = 1.0 / time_limit;
    constexpr double CLOCKS_PER_SEC_INV = 1.0 / CLOCKS_PER_SEC;
    inline double nowtime() { return CLOCKS_PER_SEC_INV * (clock() - start_clock); }
    inline bool intime() { return nowtime() < time_limit; }
    inline double progress() { return nowtime() * time_limit_inv; }
    struct preexec_dummy {
        preexec_dummy() {
            start_clock = clock();
        }
    } preexec_dummy_instance;
}

// [[/LIBRARY]]

constexpr ll d = 365;
constexpr ll z = 26;

ll calc_score(const vector<ll> &p, const vector<ll> &c, const vector<vector<ll>> &s) {
    ll score = 0;
    vector last(z, -1);
    REP(i, d) {
        ll j = p[i];
        score += s[i][j];
        score -= (i - last[j]) * (i - last[j] - 1) / 2 * c[j];
        last[j] = i;
    }
    REP(j, z) {
        const ll x = d-1 - last[j];
        score -= x * (x + 1) / 2 * c[j];
    }
    return score;
}

void output(const vector<ll> &ans) {
    FOREACH(x, ans) {
        say(x + 1);
    }
}

// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    ll dummy;
    
    cin >> dummy;
    vector<ll> c = qin(z);
    vector s(d, vector(z, (ll)0LL));
    REP(i, d) REP(j, z) cin >> s[i][j];

    vector jcand(d, vector(z, (ll)0LL));
    REP(i, d) {
        auto &r = jcand[i];
        iota(ALLOF(r), 0LL);
        sort(ALLOF(r), [&](ll x, ll y) {
            return s[i][x] > s[i][y];
        });
    }

    vector ans(d, (ll)0LL);
    ll score = -LINF;

    REP(i, d) {
        ll smax = -LINF;
        ans[i] = jcand[i][0];
    }
    score = calc_score(ans, c, s);

    vector<vector<ll>> poss(z);
    REP(j, z) poss[j].push_back(-1);
    REP(i, d) {
        ll j = ans[i];
        poss[j].push_back(i);
    }
    REP(j, z) poss[j].push_back(d);

    ll epochs = 0;
    ll maxscore = score;
    ll debug_samples = 0;
    ll debug_accepted = 0;
    ll debug_rejected = 0;
    ll debug_annealing = 0;
    double debug_i_avg = 0;
    double debug_j_avg = 0;
    double debug_k_avg = 0;
    double debug_sij_avg = 0;
    double debug_cj_avg = 0;
    double debug_jprev_avg = 0;
    double debug_sijprev_avg = 0;
    double debug_cjprev_avg = 0;

    for (double t = 0; (t = marathon::progress()) <= 0.98; ) {
        const double annealing_temp = 300 + 10000 * pow(1-t, 2);
        REP(ganmo, 100) {
            
            // 行動決定・書き換え
            ll i = xor128() % d;
            ll jprev = ans[i];
            ll k = rand_uniform() * rand_uniform() * (t < 0.2 ? 4 : 8);
            ll j = jcand[i][k];
            if (j == jprev) j = jcand[i][++k];
            ans[i] = j;

            // 差分計算
            ll score2 = score;
            ll prev_prev, next_prev;
            auto previtr = find(ALLOF(poss[jprev]), i);
            {
                auto litr = previtr;
                auto ritr = litr;
                litr--; ritr++;
                prev_prev = *litr, next_prev = *ritr;
            }
            auto planitr = upper_bound(ALLOF(poss[j]), i);
            ll prev_curr, next_curr;
            {
                auto litr = planitr; litr--;
                auto ritr = planitr;
                prev_curr = *litr, next_curr = *ritr;
            }
            score2 -= (next_prev - i) * (i - prev_prev) * c[jprev];
            score2 += (next_curr - i) * (i - prev_curr) * c[j];
            score2 -= s[i][jprev];
            score2 += s[i][j];

            // デバッグ表示
            if (DEBUG_MODE) {
                if (chmax(maxscore, score2)) {
                    // DUMP(tuple(i, k, pair(j, pair(s[i][j], c[j])), pair(jprev, pair(s[i][jprev], c[jprev]))));
                    debug_samples++;
                    debug_i_avg += i;
                    debug_k_avg += k;
                    debug_j_avg += j;
                    debug_sij_avg += s[i][j];
                    debug_cj_avg += c[j];
                    debug_jprev_avg += jprev;
                    debug_sijprev_avg += s[i][jprev];
                    debug_cjprev_avg += c[jprev];
                }
            }

            // 遷移判定
            bool accept = score < score2;
            if (!accept) {
                if (DEBUG_MODE) debug_annealing++;
                if (score - score2 < 5 * annealing_temp)
                if (rand_prob(exp((double)(score2 - score) / annealing_temp))) {
                    accept = true;
                }
            }
            
            // 遷移処理
            if (accept) {
                poss[jprev].erase(previtr);
                poss[j].insert(planitr, i);
                score = score2;
            } else {
                ans[i] = jprev;
            }

            // デバッグ
            if (DEBUG_MODE) {
                ++(accept ? debug_accepted : debug_rejected);
            }
            
            epochs++;

        }
    }

    if (DEBUG_MODE) {
        debug_i_avg /= debug_samples;
        debug_k_avg /= debug_samples;
        debug_j_avg /= debug_samples;
        debug_sij_avg /= debug_samples;
        debug_cj_avg /= debug_samples;
        debug_jprev_avg /= debug_samples;
        debug_sijprev_avg /= debug_samples;
        debug_cjprev_avg /= debug_samples;
        DUMP(debug_i_avg);
        DUMP(debug_k_avg);
        DUMP(debug_j_avg);
        DUMP(debug_sij_avg);
        DUMP(debug_cj_avg);
        DUMP(debug_jprev_avg);
        DUMP(debug_sijprev_avg);
        DUMP(debug_cjprev_avg);
        DUMP(debug_accepted);
        DUMP(debug_rejected);
        DUMP(debug_annealing);
        DUMP(tuple(score, epochs));
    }

    output(ans);

}

Measured memory_bytes: 4440