#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <chrono>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}

struct XorShift { // Reference: http://yukicoder.me/submissions/44108
    unsigned z;
    XorShift() : z((unsigned)time(NULL)) {}
    XorShift(int seed) : z(z) {}
    unsigned next() {
        z ^= z << 13;
        z ^= z >> 17;
        z ^= z << 5;
        return z;
    }
    unsigned nextInt(unsigned a, unsigned b) {
        return next() % (b - a + 1) + a;
    }
    double nextDouble() {
        return next() / (double)(1ll << 32);
    }
};

int D;
vector<ll> C;
vector<vector<ll>> S;
vector<int> T;

struct state {
    vector<ll> pen, cpen;
    vector<int> TT;
    ll ans;
};

state incremental(ll ans, vector<ll> pen, vector<ll> cpen, vector<int> TT, int d, int c) {
    int prev = TT[d];
    int cur = c;
    ans += cpen[prev] + cpen[cur];
    ans -= S[d][prev];
    ans += S[d][cur];
    pen[prev] = 0;
    pen[cur] = 0;
    cpen[prev] = 0;
    cpen[cur] = 0;
    TT[d] = c;
    rep(i, D) {
        pen[prev] += C[prev];
        pen[cur] += C[cur];
        if(TT[i] == prev) pen[prev] = 0;
        if(TT[i] == cur) pen[cur] = 0;
        cpen[prev] += pen[prev];
        cpen[cur] += pen[cur];
    }
    ans -= cpen[prev] + cpen[cur];
    return {pen, cpen, TT, ans};
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    auto start = chrono::system_clock::now();
    // source code
    cin >> D;
    C.resize(26);
    rep(i, 26) cin >> C[i];
    S.resize(D, vector<ll>(26));
    rep(i, D) rep(j, 26) cin >> S[i][j];
    T.resize(D);
    
    rep(i, D) {
        ll ma = 0;
        int ind = -1;
        rep(j, 26) {
            if(S[i][j] > ma) {
                ind = j;
                ma = S[i][j];
            }
        }
        T[i] = ind;
    }
    ll ans = 0;
    vector<ll> pen(26);
    vector<ll> cpen(26);
    rep(i, D) {
        ans += S[i][T[i]];
        rep(j, 26) pen[j] += C[j];
        pen[T[i]] = 0;
        rep(j, 26) {
            cpen[j] += pen[j];
            ans -= pen[j];
        }
    }
    
    state F = {pen, cpen, T, ans};
    
    XorShift xs;
    rep(xx, 100000) {
        pair<int, int> m1 = mp(xs.nextInt(0, D - 1), xs.nextInt(0, 25));
        state FS = incremental(F.ans, F.pen, F.cpen, F.TT, m1.first, m1.second);
        if(FS.ans > F.ans) {
            F = FS;
        }
    }
    while(1) {
        if(xs.nextInt(0, 5) < 4) {
            int d1 = xs.nextInt(0, D - 1);
            int q1 = F.TT[d1];
            int d2 = xs.nextInt(0, D - 1);
            int q2 = F.TT[d2];
            state FS = incremental(F.ans, F.pen, F.cpen, F.TT, d1, q2);
            state FSS = incremental(FS.ans, FS.pen, FS.cpen, FS.TT, d2, q1);
            if(FSS.ans > F.ans) {
                F = FSS;
            }
        }
        else {
            pair<int, int> m1 = mp(xs.nextInt(0, D - 1), xs.nextInt(0, 25));
            pair<int, int> m2 = mp(xs.nextInt(0, D - 1), xs.nextInt(0, 25));
            state FS = incremental(F.ans, F.pen, F.cpen, F.TT, m1.first, m1.second);
            state FSS = incremental(FS.ans, FS.pen, FS.cpen, FS.TT, m2.first, m2.second);
            if(FSS.ans > F.ans) {
                F = FSS;
            }
        }
        auto elapsed_time_msec = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();
        if(elapsed_time_msec > 1960) break;
    }
    
    rep(i, D) {
        output(F.TT[i] + 1);
    }
    
    return 0;
}


Measured memory_bytes: 3732