#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;
constexpr double TL = 1.9;

random_device seed_gen;
mt19937 mt(seed_gen());
uniform_int_distribution<int> con(0,26-1);
uniform_int_distribution<int> day(0,365-1);
uniform_int_distribution<int> num(0,20);
uniform_real_distribution<double> pro(0.0,1.0);

clock_t start,fin;
int D;
int c[26];
int s[365][26];
int last[26];
int answer[365];
ll before_max;
int score_contest[26];
const double t0 = 1e6,t1 = 1e3;

ll compute_res() {
    ll ans = 0;
    vector<int> before2(26,-1);
    rep(i,D) {
        int t = answer[i];
        ans -= (i - before2[t]) * (i - before2[t] - 1)/2 * c[t];
        before2[t] = i;
        ans += s[i][t];
    }
    rep(i,26) {
        ans -= (D - before2[i]) * (D - 1 - before2[i])/2 * c[i];
    }
    return ans;
}

ll compute_swap() {
    ll ans = 0;
    vector<int> before2(26,-1);
    rep(i,D) {
        int t = answer[i];
        before2[t] = i;
        ll ret = s[i][t];
        rep(j,26) {
            ret -= (i - before2[j]) * c[j];
        }
        ans += ret;
    }
    return ans;
}

int calc_score(int d,int i) {
    int bf = last[i];
    last[i] = d;
    int res = s[d][i];
    rep(j,26) {
        res -= (d - last[j]) * c[j];
    }
    last[i] = bf;
    return res;
}

void optimization() {
    rep(d,D) {
        int max_score = -INF;
        int best_i = -1;
        rep(i,26) {
            int x = calc_score(d,i);
            if (x > max_score) {
                max_score = x;
                best_i = i;
            }
        }
        last[best_i] = d; 
        answer[d] = best_i;
    }
}

void change_day() {
    int d = day(mt);
    int q = con(mt);

    if (answer[d] == q) return;
    int old = answer[d];
    answer[d] = q;
    ll score = compute_res();
    if (before_max < score) {
        before_max = score;
        return;
    }
    else {
        answer[d] = old;
        return;
    }
}

void two_swap() {
    int d1 = day(mt);
    int d2 = min(d1 + num(mt),D);
    swap(answer[d1],answer[d2]);
    ll score = compute_res();
    if (before_max < score) {
        before_max = score;
        return;
    }
    else {
        double t = (double)(fin - start)/CLOCKS_PER_SEC/TL;
        double T = pow(t0,1 - t) * pow(t1,t);
        if (exp((score - before_max)/T) > pro(mt)) {
            before_max = score; return;
        }
        else {
            swap(answer[d1],answer[d2]);return;
        }
    }
}

int main() {
    clock_t start = clock();
    cin >> D;
    rep(i,26) cin >> c[i];
    rep(i,D)rep(j,26) cin >> s[i][j];
    fill(last,last + 26,-1);
    
    /*
    //答え確認用
    printf("%d\n",D);
    rep(i,26) printf("%d ",c[i]); 
    cout << '\n';
    rep(i,D){
        rep(j,26) printf("%d ",s[i][j]);
        cout << '\n';
    }
    */

    optimization();
    before_max = compute_res();
    fin = clock();
    while ((double)(fin - start)/CLOCKS_PER_SEC < TL) {
        if (pro(mt) <= 0.4) change_day();
        else two_swap();
        fin = clock();
    }
    rep(i,D) printf("%d\n",answer[i] + 1);
    return 0;
}


Measured memory_bytes: 4404