#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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 (a>b) { a=b; return 1; } return 0; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

const ll INF = (1ll<<60);

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

ll calc_score(ll D, vector<ll> &c, vector<vector<ll>> &s, vector<ll> &t){
    ll res = 0;
    vector<ll> last(26, -1);
    REP(d, D){
        res += s[d][t[d]];
        last[t[d]] = d;
        REP(i, 26){
            res -= c[i] * (d  - last[i]);
        }
        //cout << res << endl;
    }
    return res;
}

ll change_score(ll D, vector<ll> &c, vector<vector<ll>> &s, vector<ll> &t, ll d, ll q, vector<set<ll>> &dict, bool update){
    ll delta = 0;
    ll p = t[d];

    // dump(p)
    // dump(q)

    // single score
    delta -= s[d][p];
    delta += s[d][q];

    // lazy score
    auto itr = dict[p].lower_bound(d);
    ll mp = *(--itr);
    itr++, itr++;
    ll ap = *itr;
    itr--;
    if(update) dict[p].erase(itr);

    ll delta1 = (-1) * c[p] * (d-mp) * (ap-d);

    itr = dict[q].upper_bound(d);
    ll aq = *itr;
    itr--;
    ll mq = *itr;
    if(update) dict[q].insert(d);

    ll delta2 = c[q] * (d-mq) * (aq-d);

    delta += delta1;
    delta += delta2;

    // update
    if(update) t[d] = q;
    return delta;
}

vector<ll> greedy(ll D, vector<ll> &c, vector<vector<ll>> &s){
    vector<ll> t(D, -1);
    vector<ll> last(26, -1);
    ll res = 0;
    REP(d, D){
        ll ma = -INF;
        ll ma_cont = -1;
        REP(cont, 26){
            ll tmp_res = res + s[d][cont];
            auto tmp_last = last;
            tmp_last[cont] = d;
            REP(i, 26){
                tmp_res -= 3 * c[i] * (d  - tmp_last[i]);
            }
            if(chmax(ma, tmp_res)) ma_cont = cont;
        }
        
        res += s[d][ma_cont];
        last[ma_cont] = d;
        REP(i, 26){
            res -= 3 * c[i] * (d  - last[i]);
        }
        t[d] = ma_cont;
    }
    return t;
}

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

    time_t start = clock();
    ll D;
    cin >> D;
    vector<ll> c(26);
    vector<vector<ll>> s(D, vector<ll>(26, 0));

    REP(i, 26) cin >> c[i];
    REP(i, D){
        REP(j, 26){
            cin >> s[i][j];
        }
    }

    auto t = greedy(D, c, s);

    vector<set<ll>> dict(26);
    REP(i, 26) dict[i].insert(-1);
    REP(i, D) dict[t[i]].insert(i);
    REP(i, 26) dict[i].insert(D);

    ll res = calc_score(D, c, s, t);
    //dump(res)

    random_device rnd;
    mt19937 mt(rnd());
    uniform_int_distribution<int> dist(0, INT_MAX);

    while((clock()-start) < 1.8*CLOCKS_PER_SEC){
        ll d = dist(mt)%D;
        ll q = dist(mt)%26;
        ll delta = change_score(D, c, s, t, d, q, dict, false);
        //dump(delta)
        //dump(res)
        if(delta>0){
            change_score(D, c, s, t, d, q, dict, true);
            res += delta;
        }
    }

    REP(i, D){
        cout << t[i]+1 << endl;
    }


    return 0;
}

Measured memory_bytes: 3788