#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int d;
    cin >> d;
    vi  c(26);
    int mxc = 0;
    int mxc_c = 0;
    REP(i, 26) {
        cin >> c[i];
        if (chmax(mxc, c[i])) mxc_c = i + 1;
    }
    vvl s(d, vl(26));
    int mx = 0;
    int mx_c = 0;
    REP(i, d) REP(j, 26) {
        cin >> s[i][j];
        if (chmax(mx, (int)s[i][j])) mx_c = j + 1;
    }

    vi last(26);
    ll ans = 0;
    vi a(d);
    REP(i, d) {
        ll ans2 = -LINF;
        ll ans_i = -1;
        REP(x, 26) {
            ll tmp = s[i][x];
            REP(j, 26) {
                if (x != j) tmp -= c[j] * ((i + 1) - last[j]);
            }
            if (chmax(ans2, tmp)) ans_i = x;
        }
        last[ans_i] = i + 1;
        ans += ans2;
        // cout << ans_i + 1 << endl;
        a[i] = ans_i + 1;
    }
    mt19937 mt{ random_device{}() };
    uniform_int_distribution<int> dist_d(1, d);
    uniform_int_distribution<int> dist_c(1, 26);
    uniform_int_distribution<int> dist_s(1, 10);
    REP(_, 210000) {
        if (_ % 3 != 0) {
            vi lst(26);
            ll ans_n = 0;
            int x = dist_d(mt);
            int y = (_ % 10 == 0 ? mx_c : _ % 20 == 5 ? mxc_c : dist_c(mt));
            REP(i, d) {
                int t = a[i];
                if (x - 1 == i) t = y;
                ans_n += s[i][t - 1];
                lst[t - 1] = i + 1;
                REP(j, 26) if (t - 1 != j) ans_n -= c[j] * ((i + 1) - lst[j]);
            }
    
            if (ans_n > ans) {
                a[x - 1] = y;
                ans = ans_n;
            }
        } else {
            vi lst(26);
            ll ans_n = 0;
            int x = dist_d(mt);
            int y = dist_s(mt);
            int x2 = x + (x + y >= d ? -y : y);
            swap(a[x - 1], a[x2 - 1]);
            REP(i, d) {
                int t = a[i];
                ans_n += s[i][t - 1];
                lst[t - 1] = i + 1;
                REP(j, 26) if (t - 1 != j) ans_n -= c[j] * ((i + 1) - lst[j]);
            }
    
            if (ans_n > ans) {
                ans = ans_n;
            } else {
                swap(a[x - 1], a[x2 - 1]);
            }
        }
    }
    printlnv(a);
#ifndef ONLINE_JUDGE    
    cout << ans << endl;
#endif
}


Measured memory_bytes: 3756