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

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<int> cnt(K, 0);
    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;
    }
    
    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;
        
        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 = ((nxt-pre)*(nxt-pre+1)/2 - ((a-pre)*(a-pre+1)/2+(nxt-a)*(nxt-a+1)/2)) * C[i] + s[a][i];
            if (pt > pt_max) {
                pt_max = pt;
                op = i;
            }
        }
        day[op].insert(a);
        ans[a] = op+1;
    }
    
    int repmax2 = 30000;
    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 += ((nxt[i]-pre[i])*(nxt[i]-pre[i]+1)/2 - ((a-pre[i])*(a-pre[i]+1)/2+(nxt[i]-b)*(nxt[i]-b+1)/2)) * C[i];
                else {
                    pt += ((nxt[i]-pre[i])*(nxt[i]-pre[i]+1)/2 - ((a-pre[i])*(a-pre[i]+1)/2+(nxt[i]-a)*(nxt[i]-a+1)/2)) * C[i];
                    pt += ((nxt[j]-pre[j])*(nxt[j]-pre[j]+1)/2 - ((b-pre[j])*(a+1-pre[j]+1)/2+(nxt[j]-b)*(nxt[j]-b+1)/2)) * 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 = 30000;
    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 += ((nxt1[i]-pre1[i])*(nxt1[i]-pre1[i]+1)/2 - ((a-pre1[i])*(a-pre1[i]+1)/2 + (b-a)*(b-a+1)/2 + (nxt1[i]-b)*(nxt1[i]-b+1)/2)) * C[i];
                }
                else {
                    pt += ((nxt1[i]-pre1[i])*(nxt1[i]-pre1[i]+1)/2 - ((a-pre1[i])*(a-pre1[i]+1)/2+(nxt1[i]-a)*(nxt1[i]-a+1)/2)) * C[i];
                    pt += ((nxt2[j]-pre2[j])*(nxt2[j]-pre2[j]+1)/2 - ((b-pre2[j])*(b-pre2[j]+1)/2+(nxt2[j]-b)*(nxt2[j]-b+1)/2)) * 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: 3756