// 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 擬似乱数発生器
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<set<ll>> poss(z);
    REP(j, z) {
        poss[j].insert(-1);
        poss[j].insert(d);
    }
    REP(i, d) {
        ll j = ans[i];
        poss[j].insert(i);
    }

    ll epochs = 0;
    ll maxscore = score;
    for (double t = 0; (t = marathon::progress()) <= 0.97; ) {
        REP(ganmo, 100) {
            
            ll i = xor128() % d;
            ll k = xor128() % (t < 0.25 ? 4 : 8);
            ll j = jcand[i][k];

            ll jprev = ans[i];

            // 行動書き換え
            ans[i] = j;

            // 差分計算
            ll score2 = score;
            ll prev_prev, next_prev;
            {
                auto litr = poss[jprev].find(i);
                auto ritr = litr;
                litr--; ritr++;
                prev_prev = *litr, next_prev = *ritr;
            }
            poss[jprev].erase(i);
            poss[j].insert(i);
            ll prev_curr, next_curr;
            {
                auto litr = poss[j].find(i);
                auto ritr = litr;
                litr--; ritr++;
                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 (false && DEBUG_MODE) {
                if (chmax(maxscore, score2)) {
                    DUMP(tuple(i, k, pair(j, c[j]), pair(jprev, c[jprev])));
                }
            }

            // 遷移判定
            bool accept = score < score2;
            if (!accept) {
                const double temp = 300 + 1000 * (1-t);
                if (rand_prob(exp((double)(score2 - score) / temp))) {
                    accept = true;
                }
            }
            
            // 遷移処理
            if (accept) {
                score = score2;
            } else {
                ans[i] = jprev;
                poss[j].erase(i);
                poss[jprev].insert(i);
            }
            
            epochs++;

        }
    }

    DUMP(tuple(score, epochs));
    output(ans);

}

Measured memory_bytes: 4452