#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
    for(int i = 0; i < (int)v.size(); i++)
        os << (i ? " " : "") << v[i];
    return os;
}
/*-------------------------------------------*/

int D;
int c[26];
ll s[365][26];

int last[26];

set<int> st[26];
vector<int> ret;
vector<int> ans;

ll sum = 0, MAX;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    srand((unsigned)time(NULL));

    rep(i, 26) st[i].insert(-1);

    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D) rep(j, 26) cin >> s[i][j];

    rep(d, D) {
        ll a = -1, mx = -1;
        rep(i, 26) if(chmax(mx, (d - *st[i].rbegin()) * c[i] + s[d][i])) a = i;
        ans.push_back(a);
        st[a].insert(d);
        sum += s[d][a];
        rep(i, 26) sum -= c[i] * (d - *st[i].rbegin());
    }

    MAX = sum;
    ret = ans;

    rep(i, 26) st[i].insert(D);

    int x;
    ll a, mx, y;
    while(clock() < CLOCKS_PER_SEC * 1.9) {
        x = rand() % D;
        a = -1, mx = -inf;
        rep(i, 26) if(i != ans[x]) {
            auto it1 = st[i].upper_bound(x);
            auto it2 = st[i].lower_bound(x);
            it2--;
            y = s[x][i] + (*it1 - *it2) * (*it1 - *it2 - 1) / 2 * c[i];
            y -= (*it1 - x) * (*it1 - x - 1) / 2 * c[i];
            y -= (x - *it2) * (x - *it2 - 1) / 2 * c[i];
            if(chmax(mx, y)) a = i;
        }
        auto it1 = st[ans[x]].upper_bound(x);
        auto it2 = st[ans[x]].lower_bound(x);
        it2--;
        y = s[x][ans[x]] + (*it1 - *it2) * (*it1 - *it2 - 1) / 2 * c[ans[x]];
        y -= (*it1 - x) * (*it1 - x - 1) / 2 * c[ans[x]];
        y -= (x - *it2) * (x - *it2 - 1) / 2 * c[ans[x]];
        if(mx >= y) {
            st[a].insert(x);
            st[ans[x]].erase(x);
            ans[x] = a;
            sum += mx - y;
            if(chmax(MAX, sum)) ret = ans;
        } else if((sum + mx - y) * 51 >= sum * 50 && rand() % 100 == 0) {
            sum += mx - y;
            st[a].insert(x);
            st[ans[x]].erase(x);
            ans[x] = a;
        }
        if(sum * 51 < MAX * 50) {
            sum = MAX;
            ans = ret;
            rep(i, 26) {
                st[i].clear();
                st[i].insert(-1);
                st[i].insert(D);
            }
            rep(i, D) st[ans[i]].insert(i);
        }
    }

    rep(i, D) cout << ret[i] + 1 << endl;

    return 0;

    cout << endl;

    sum = 0;
    rep(d, D) {
        int x = ret[d];
        last[x] = d + 1;
        sum += s[d][x];
        rep(i, 26) sum -= (d + 1 - last[i]) * (c[i]);
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3748