#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    int d;
    cin >> d;
    vint c(26);
    cin >> c;
    vector<vint> s(d, vint(26));
    REP(i, d) {
        REP(j, 26) { cin >> s[i][j]; }
    }
    // ll score = 0;
    int beamwid = 850;
    vector<vint> last(beamwid, vint(26, -1));
    vint scores(beamwid, 0);
    vector<vint> ans_ind(beamwid, vint(d, -1));

    map<ll, ll> ma;
    vint last_tmp(26, -1);
    REP(k, 26) {
        ll score = 0;
        int nowcont = k;
        score += s[0][nowcont];
        last_tmp[nowcont] = 0;
        REP(j, 26) { score -= c[j] * (0 - last_tmp[j]); }
        ma[score] = k;
        last_tmp[nowcont] = -1;
    }
    int cnt = 0;
    for (auto ite = ma.rbegin(); ite != ma.rend(); ++ite) {
        scores[cnt] = ite->first;
        last[cnt][ite->second] = 0;
        ans_ind[cnt][0] = ite->second + 1;
        ++cnt;
        if (cnt == beamwid) break;
    }

    FOR(i, 1, d) {
        map<ll, pair<ll, ll>> ma;
        REP(j, beamwid) {
            REP(k, 26) {
                ll nowscore = scores[j];
                int oldlast = last[j][k];
                last[j][k] = i;
                nowscore += s[i][k];
                REP(l, 26) { nowscore -= c[l] * (i - last[j][l]); }
                // cerr << s[i][k] << "test" << endl;
                ma[nowscore] = make_pair(j, k);
                last[j][k] = oldlast;
            }
        }
        // cout << "test" << endl;
        vector<vint> newlast(beamwid, vint(26, -1));
        vint newscores(beamwid, 0);
        vector<vint> new_ans_ind(beamwid, vint(d, -1));
        int cnt = 0;
        for (auto ite = ma.rbegin(); ite != ma.rend(); ++ite) {
            //if (cnt == 0) cout << ite->first << endl;
            newscores[cnt] = ite->first;
            newlast[cnt] = last[ite->second.first];
            newlast[cnt][ite->second.second] = i;
            new_ans_ind[cnt] = ans_ind[ite->second.first];
            new_ans_ind[cnt][i] = ite->second.second + 1;
            cnt++;
            if (cnt == beamwid) break;
        }
        last = newlast;
        scores = newscores;
        ans_ind = new_ans_ind;
    }
    REP(i, d) { cout << ans_ind[0][i] << endl; }
}


Measured memory_bytes: 7028