#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

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 findL(const set<int>& days, int now) {
    auto itr = days.lower_bound(now);
    if (itr == days.begin())return 0;
    --itr;
    return *itr;
}

int findR(const set<int>& days, int now) {
    auto itr = days.upper_bound(now);
    return itr == days.end() ? D : *itr;
}

int diff(const Row& c, const Table& s, const int x, const int kind, const set<int>& days) {
    int l = findL(days, x), r = findR(days, x);
    return s[x][kind] + c[kind] * (r - x)*(x - l);
}


int main()
{
    using namespace std::chrono;
    auto start = system_clock::now();
    random_device rnd;
    mt19937 mt(rnd());
    uniform_int_distribution<> randD(0, D - 1), randK(0, K - 1);

    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);
    //cout << calcScore(c, s, schedule) << endl;
    //auto base = schedule;

    while (duration_cast<milliseconds>(system_clock::now() - start).count() < 1900) {
        rep(i, 100) {
            int x = randD(mt);
            int alpha = randK(mt);
            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 (valA < valB)continue;
            //cout << "clear" << endl;
            //cerr << x << " " << alpha << " " << beta << " " << valA << "<-" << valB << endl;
            schedule[x] = alpha;
            cpr[alpha].insert(x);
            cpr[beta].erase(x);
        }
    }
    //cout << calcScore(c, s, schedule) << endl;
    //rep(i, D)if (schedule[i] != base[i])cout << i << " ";
    for (auto t : schedule)cout << t + 1 << endl;
    return 0;;
}


Measured memory_bytes: 3704