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

ll rangesum(ll N) {
    return N*(N+1)/2;
}

int main(){
    int K = 26;
    int D;
    cin >> D;
    vector<ll> C(K);
    for (int i = 0; i < K; i++) cin >> C[i];
    vector<vector<ll>> s(D+1, vector<ll>(K, 0));
    for (int i = 1; i <= D; i++) {
        for (int j = 0; j < K; j++) {
            cin >> s[i][j];
        }
    }
    
    vector<int> ans(D+1, 0);
    
    vector<set<int>> day(K);
    for (int i = 0; i < K; i++) {
        day[i].insert(0);
        day[i].insert(D+1);
    }
    
    vector<pair<int, int>> start;
    for (int i = 1; i <= D; i++) {
        int op = 0;
        int s_mx = 0;
        for (int j = 0; j < K; j++) {
            if (s_mx < s[i][j]) {
                s_mx = s[i][j];
                op = j;
            }
        }
        day[op].insert(i);
        ans[i] = op+1;
        start.push_back({s_mx, i});
    }
    sort(start.begin(), start.end());
    
    ll inf = 1e18;
    ll r = 123456789;
    ll mod = 1e9+7;
    
    int repmax1 = 50000;
    for (int rep = 0; rep < repmax1; rep++) {
        r = r*r%mod;
        int a = r%D+1;
        
        if (rep < D) a = start[rep%D].second;
        
        int def = ans[a]-1;
        
        ll pt_max = -inf; 
        ll op = 0;
        day[def].erase(day[def].find(a));
        for (int i = 0; i < K; i++) {
            auto it = day[i].lower_bound(a);
            ll nxt = (*it);
            it--;
            ll pre = (*it);
            ll pt = (rangesum(nxt-pre-1) - (rangesum(a-pre-1)+rangesum(nxt-a-1))) * C[i] + s[a][i];
            if (pt > pt_max) {
                pt_max = pt;
                op = i;
            }
        }
        day[op].insert(a);
        ans[a] = op+1;
    }
    /*
    int repmax2 = 50000;
    for (int rep = 0; rep < repmax2; rep++) {
        r = r*r%mod;
        int a = r%(D-1)+1;
        int b = a+1;
        
        int def1 = ans[a]-1;
        int def2 = ans[b]-1;
        
        ll pt_max = -inf; 
        ll op1 = 0, op2 = 0;
        day[def1].erase(day[def1].find(a));
        day[def2].erase(day[def2].find(b));
        vector<int> nxt(K), pre(K);
        for (int i = 0; i < K; i++) {
            auto it = day[i].lower_bound(a);
            nxt[i] = (*it);
            it--;
            pre[i] = (*it);
        }
        
        for (int i = 0; i < K; i++) {
            for (int j = 0; j < K; j++) {
                ll pt = s[a][i]+s[b][j];
                if (i == j) pt += (rangesum(nxt[i]-pre[i]-1) - (rangesum(a-pre[i]-1)+rangesum(nxt[i]-b-1))) * C[i];
                else {
                    pt += (rangesum(nxt[i]-pre[i]-1) - (rangesum(a-pre[i]-1)+rangesum(nxt[i]-a-1))) * C[i];
                    pt += (rangesum(nxt[j]-pre[j]-1) - (rangesum(b-pre[j]-1)+rangesum(nxt[j]-b-1))) * C[j];
                }
                if (pt > pt_max) {
                    pt_max = pt;
                    op1 = i;
                    op2 = j;
                }
            }
        }
        day[op1].insert(a);
        day[op2].insert(b);
        ans[a] = op1+1;
        ans[b] = op2+1;
    }
    */
    
    int repmax3 = 400000;
    for (int rep = 0; rep < repmax3; rep++) {
        r = r*r%mod;
        int a = r%D+1;
        r = r*r%mod;
        int b = r%D+1;
        while (a == b) {
            r = r*r%mod;
            b = r%D+1;
        }
        if (a > b) swap(a, b);
        
        int def1 = ans[a]-1;
        int def2 = ans[b]-1;
        
        ll pt_max = -inf; 
        ll op1 = 0, op2 = 0;
        day[def1].erase(day[def1].find(a));
        day[def2].erase(day[def2].find(b));
        vector<int> nxt1(K), pre1(K), nxt2(K), pre2(K);
        for (int i = 0; i < K; i++) {
            auto it = day[i].lower_bound(a);
            nxt1[i] = (*it);
            it--;
            pre1[i] = (*it);
        }
        for (int i = 0; i < K; i++) {
            auto it = day[i].lower_bound(b);
            nxt2[i] = (*it);
            it--;
            pre2[i] = (*it);
        }
        
        for (int i = 0; i < K; i++) {
            for (int j = 0; j < K; j++) {
                ll pt = s[a][i]+s[b][j];
                if (i == j && pre1[i] == pre2[i]) {
                    pt += (rangesum(nxt1[i]-pre1[i]-1) - (rangesum(a-pre1[i]-1) + rangesum(b-a-1) + rangesum(nxt1[i]-b-1))) * C[i];
                }
                else {
                    pt += (rangesum(nxt1[i]-pre1[i]-1) - (rangesum(a-pre1[i]-1)+rangesum(nxt1[i]-a-1))) * C[i];
                    pt += (rangesum(nxt2[j]-pre2[j]-1) - (rangesum(b-pre2[j]-1)+rangesum(nxt2[j]-b-1))) * C[j];
                }
                if (pt > pt_max) {
                    pt_max = pt;
                    op1 = i;
                    op2 = j;
                }
            }
        }
        day[op1].insert(a);
        day[op2].insert(b);
        ans[a] = op1+1;
        ans[b] = op2+1;
    }
    
    for (int i = 1; i <= D; i++) cout << ans[i] << endl;
    
    return 0;
}


Measured memory_bytes: 3728