#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}

mt19937 mt;          
random_device rnd;
ll now_score;
int n = 26;
int D;
ll c[26];
ll s[365][26];
set<int> st[26];
int last[26];
int res[365];
double start_temp = 5000;
double end_temp = 300;
chrono::system_clock::time_point  start; 
chrono::system_clock::time_point  eend;
void climing(){
    int day = mt()%365;
    int ch = mt()%26;
    while(ch==res[day]){
        ch = mt()%26;
    }
    ll score = 0;
    score += s[day][ch] - s[day][res[day]];
    auto x = st[res[day]].lower_bound(day);
    ll pre;
    if(x==st[res[day]].begin()){
        pre = -1;
    }else{
        x--;
        pre = (*x);
        x++;
    }
    x++;
    ll nxt;
    if(x==st[res[day]].end()){
        nxt = D;
    }else{
        nxt = (*x);
    }
    score -= (nxt-pre-1)*(nxt-pre)/2*c[res[day]] - (nxt-day-1)*(nxt-day)/2*c[res[day]] - (day-pre-1)*(day-pre)/2*c[res[day]];   
    x = st[ch].lower_bound(day);
    if(x==st[ch].begin()){
        pre = -1;
    }else{
        x--;
        pre = (*x);
        x++;
    }
    if(x==st[ch].end()){
        nxt = D;
    }else{
        nxt = (*x);
    }
    score += (nxt-pre-1)*(nxt-pre)/2*c[ch] - (nxt-day-1)*(nxt-day)/2*c[ch] - (day-pre-1)*(day-pre)/2*c[ch];   
    
    
    eend = std::chrono::system_clock::now();  // 計測終了時間
    double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(eend-start).count(); 
    double temp = start_temp + (end_temp - start_temp) * (elapsed) / 1950.0;
    // 遷移確率関数(最大化の場合)
    double prob = exp((score)/temp);

    if (prob > (rand()%inf)/(double)inf) { // 確率probで遷移する
        st[res[day]].erase(day);
        st[ch].insert(day);
        res[day] = ch;
        // eend = std::chrono::system_clock::now();  // 計測終了時間
        // double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(eend-start).count(); 
        // cerr << elapsed << endl;
   
        // now_score += score;
    }
    // if(score>0){
    //     st[res[day]].erase(day);
    //     st[ch].insert(day);
    //     res[day] = ch;
    //     // eend = std::chrono::system_clock::now();  // 計測終了時間
    //     // double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(eend-start).count(); 
    //     // cerr << elapsed << endl;
    //     // cerr << score << endl;
    // }
    // else{
    //     eend = std::chrono::system_clock::now();  // 計測終了時間
    //     double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(eend-start).count(); 
    //     if(elapsed>=1800)return;
    //     int k = mt()%1000;
    //     if(k<=50){
    //         st[res[day]].erase(day);
    //         st[ch].insert(day);
    //         res[day] = ch;

    //     }
    // }
    // cerr << "test" << endl;
}
void init(){
    //初期解
    rep(i,D){
        ll mx = 0;
        res[i] = mt()%26;
        // rep(j,26){
        //     if(chmax(mx,s[i][j]+ c[j]*(i-last[j]))){
                
        //         res[i] = j;
        //     }
        // }
        last[res[i]] = i;
        // now_score += s[i][res[i]];
        // rep(j,26){
        //     now_score -= c[j]*(i-last[j]);
        // }
        st[res[i]].insert(i);
    }
    return;
}
int main(){
    start = std::chrono::system_clock::now(); // 計測開始時間
    mt.seed(rnd());
    cin >> D;
    rep(i,n){
        cin >> c[i];
    }
    rep(i,D){
        rep(j,26){
            cin >> s[i][j];
        }
    }
    init();
    while(1){
        eend = std::chrono::system_clock::now();  // 計測終了時間
        double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(eend-start).count(); 
        if(elapsed >= 1980)break;
        climing();
    }
    rep(i,D){
        cout << res[i]+1 << "\n";
    }
    // cerr << now_score << endl;
    return 0;
}

Measured memory_bytes: 3848