#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
// ============ template finished ============

constexpr int D = 365;
constexpr int K = 26;
using Row = array<int, K>;
using Table = array<Row, D>;
using Result = array<int, D>;
using CPResult = array<set<int>, K>; //compressed result

constexpr float maxRand = 3000;
constexpr int LIM_MS = 1950;
constexpr unsigned long BIG = 1ll << 60;
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
bool isChange(const int& time, const int& scoreDiff) {
    float temp = maxRand * (LIM_MS - time) / 1900;
    float prob = expf((float)scoreDiff / temp);
    float rand = (float)(xor128() % BIG) / BIG;
    return prob > rand;
}

int penalty(const Row& c, const Row& last, const int& use, const int& nowDay) {
    int res = 0;
    rep(i, K)if (i != use)res += c[i] * (nowDay - last[i]);
    return res;
}

Result init(const Row& c, const Table& s) {
    Result schedule;
    Row last;
    rep(i, K)last[i] = 0;

    rep(i, D) {
        int score = -INF, res = -1;
        rep(j, K) {
            int tscore = s[i][j] - penalty(c, last, j, i);
            if (tscore > score) {
                score = tscore;
                res = j;
            }
        }
        schedule[i] = res;
        last[res] = i;
    }
    return schedule;
}

ll calcScore(const Row& c, const Table& s, const Result& schedule) {
    ll score = 0;
    Row last;
    rep(i, K)last[i] = 0;
    rep(i, D) {
        score += s[i][schedule[i]];
        last[schedule[i]] = i + 1;
        rep(j, K)score -= c[j] * (i + 1 - last[j]);
    }
    return score;
}

CPResult compress(const Result& schedule) {
    CPResult cpr;
    rep(i, D)cpr[schedule[i]].insert(i);
    return cpr;
}

int diff(const Row& c, const Table& s, const int& x, const int& kind, const set<int>& days) {
    auto itr = days.lower_bound(x);
    const int l = itr == days.begin() ? 0 : *(--itr);
    const auto itr2 = days.upper_bound(x);
    const int r = itr2 == days.end() ? D : *itr2;
    return s[x][kind] + c[kind] * (r - x)*(x - l);
}

int main()
{
    using namespace std::chrono;
    auto start = system_clock::now();
    int tmp;
    cin >> tmp;

    Row c;
    Table s;
    rep(i, K)cin >> c[i];
    rep(i, D)rep(j, K)cin >> s[i][j];
    auto schedule = init(c, s);
    auto cpr = compress(schedule);

    int cnt = 0;
    while (true) {
        const auto time = duration_cast<milliseconds>(system_clock::now() - start).count();
        if (LIM_MS < time)break;
        rep(i, 1000) {
            int x = xor128() % D;
            int alpha = xor128() % K;
            int beta = schedule[x];
            if (alpha == beta)continue;
            int valA = diff(c, s, x, alpha, cpr[alpha]);
            int valB = diff(c, s, x, beta, cpr[beta]);
            if (isChange(time, valA - valB)) {
                schedule[x] = alpha;
                cpr[alpha].insert(x);
                cpr[beta].erase(x);
            }
        }
    }
    //cout << calcScore(c, s, schedule) << endl;
    for (auto t : schedule)cout << t + 1 << endl;
    return 0;;
}


Measured memory_bytes: 4000