#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
void get_unique(vector<T>& x) {
    x.erase(unique(x.begin(), x.end()), x.end());
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
random_device rnd;
int main() {
    clock_t start = clock();
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];
    vector<int> last(26, -1);
    auto calc = [&](int day, int type) {
        int ret = 0;
        ret += s[day][type];
        rep(i, 26) if (i != type) ret -= c[i] * (day - last[i]);
        return ret;
    };

    int score = 0;
    vector<int> t(D);
    rep(d, D) {
        int MAX = -INF;
        rep(i, 26) if (chmax(MAX, calc(d, i))) t[d] = i;
        last[t[d]] = d;
        score += MAX;
    }

    vector<set<int>> st(26);
    rep(i, D) st[t[i]].insert(i);
    auto diff = [&](int d, int q) {
        int p = t[d];
        t[d] = q;
        int ret = 0;
        ret -= s[d][p];
        ret += s[d][q];
        {
            auto itr = st[p].find(d);
            int d1 = (itr == st[p].begin() ? -1 : *(--itr));
            if (~d1) itr++;
            int d2 = (itr == --st[p].end() ? D : *(++itr));
            ret -= c[p] * (d - d1) * (d2 - d);
        }
        st[p].erase(d);
        st[q].insert(d);
        {
            auto itr = st[q].find(d);
            int d1 = (itr == st[q].begin() ? -1 : *(--itr));
            if (~d1) itr++;
            int d2 = (itr == --st[q].end() ? D : *(++itr));
            ret += c[q] * (d - d1) * (d2 - d);
        }
        return ret;
    };
    int cnt = 0;
    while (1) {
        cnt++;
        if (uniform_int_distribution<int>(0, 1)(rnd)) {
            int d1 = uniform_int_distribution<int>(0, D - 1)(rnd);
            int d2 = d1;
            while (d1 == d2 || t[d1] == t[d2])
                d2 = uniform_int_distribution<int>(0, D - 1)(rnd);
            int p = t[d1];
            int q = t[d2];
            int now_diff = diff(d1, q) + diff(d2, p);
            if (now_diff < 0) {
                t[d1] = p;
                t[d2] = q;
                st[q].insert(d2);
                st[p].erase(d2);
                st[p].insert(d1);
                st[q].erase(d1);
            } else {
                score += now_diff;
            }
        } else {
            int d = uniform_int_distribution<int>(0, D - 1)(rnd);
            int q = uniform_int_distribution<int>(0, 25)(rnd);
            int p = t[d];
            int now_diff = diff(d, q);
            if (now_diff < 0) {
                t[d] = p;
                st[p].insert(d);
                st[q].erase(d);
            } else {
                score += now_diff;
            }
        }
        clock_t end = clock();
        const double time =
            static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
        if (time > 1900) break;
    }
    rep(i, D) cout << t[i] + 1 << '\n';
    // cout << cnt << ' ' << score << '\n';
}

Measured memory_bytes: 3692