#include <bits/stdc++.h>

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int _i=(first);_i<(last);++_i){cout<<#a<<"["<<_i<<"] = "<<(a)[_i]<<endl;}
#define PRINTP(p)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#p<<" = ("<<(p.first)<<", "<<(p.second)<<")"<<endl;
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTP(p)
#define PRINTI(a,i)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
//#define MOD 998244353

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

template <class T>
using vec2 = vector<vector<T>>;

template <class T>
using vec3 = vector<vector<vector<T>>>;

const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};



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

    mt19937 mt;
    uniform_real_distribution<float> uniform(0, 1);

    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> t(D);

    /*
    REP(i, D) {
        t[i] = mt() % 26;
    }
    */

    REP(d, D) {
        int s_max = INT_MIN;
        int i_max;
        REP(i, 26) {
            if (s_max < s[d][i]) {
                s_max = s[d][i];
                i_max = i;
            }
        }
        t[d] = i_max;
    }

    function<int(void)> get_score = [&]() {
        int score = 0;
        vector<int> last(26, -1);
        REP(d, D) {
            score += s[d][t[d]];
            last[t[d]] = d;
            REP(i, 26) {
                score -= c[i] * (d - last[i]);
            }
        }
        return score;
    };


    int score = get_score();


    vector<set<int>> se(26, {-1, D});
    REP(d, D) {
        se[t[d]].insert(d);
    }


    function<void(int, int)> update = [&](int d, int q) {
        auto it = se[t[d]].find(d);
        int L1 = *it - *prev(it);
        int L2 = *next(it) - *it;
        se[t[d]].erase(d);
        se[q].insert(d);
        it = se[q].find(d);
        int L3 = *it - *prev(it);
        int L4 = *next(it) - *it;
        int L12 = L1 + L2;
        int L34 = L3 + L4;
        score += s[d][q] - s[d][t[d]] + ((c[t[d]] * (L1 * (L1 - 1) + L2 * (L2 - 1) - L12 * (L12 - 1)) + c[q] * (L34 * (L34 - 1) - L3 * (L3 - 1) - L4 * (L4 - 1))) >> 1);
        t[d] = q;
    };


    float alpha = 0.00001;
    PRINT(alpha);

    int score_best = score;
    vector<int> t_best = t;

    int T_MAX = 5200000;
    REP(T, T_MAX) {

        int score_old = score;
        int d = mt() % D;
        int t_old = t[d];
        int t_new = t_old + 1 + mt() % (26 - 1);
        if (t_new >= 26) t_new -= 26;
        
        update(d, t_new);

        if (score_best < score) {
            score_best = score;
            t_best = t;
        }

        //if (score > score_old || uniform(mt) < exp(alpha * (score - score_old))) {
        if (score > score_old || uniform(mt) < exp(alpha * (score - score_old)) / (T_MAX - T)) {
        //if (score > score_old || uniform(mt) < exp(alpha * (score - score_old)) * T) {
            // pass
        } else {
            update(d, t_old);
        }
    }
    
    REP(i, D) {
        cout << (t_best[i] + 1) << '\n'; // 1-based indexing
    }
    cout << flush;

    PRINT(score_best);

    return 0;
}


Measured memory_bytes: 3880