#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>

using namespace std;

constexpr unsigned long long int CYCLES_PER_SEC = 2800000000;
constexpr double CYCLE_SEC = 1.0 / CYCLES_PER_SEC;
constexpr double TIME_LIMIT = 1.95;
constexpr double TIME_LIMIT_INV = 1.0 / TIME_LIMIT;
constexpr int ITER_PER_EPOCH = 100;

unsigned long long int get_cycle(){
    unsigned int low, high;
    __asm__ volatile("rdtsc" : "=a" (low), "=d" (high));
    return ((unsigned long long int)low) | ((unsigned long long int)high << 32);
}

double get_time(unsigned long long int begin_cycle){
    return (double)(get_cycle() - begin_cycle) * CYCLE_SEC;
}

// Fast randoms
// [0, 2^64)
inline unsigned xrand() {
  static unsigned x = 314159265, y = 358979323, z = 846264338, w = 327950288;
  unsigned t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8;
}
 
// [a, b)
inline int xrand(int a, int b) { return a + xrand() % (b - a); }
 
// [0.0, 1.0)
inline double xrand_uniform() { return xrand() * 2.328306436538696e-10; }

inline double xexp(double x){
    if(x < -20.0){ return 0.0; }
    x = 1.0 + x * 0.00390625;
    x *= x; x *= x; x *= x; x *= x;
    x *= x; x *= x; x *= x; x *= x;
    return x;
}

int D;
int c[26];
int s[365][26];
int t[365];

struct State{
    int schedule[365];
    int score;
    int history[365][26];

    void init() {
        int last[26] = {0};
        score = 0;
        for(int i=0; i<D; ++i){
            int val = 0;
            for(int j=0; j<26; ++j){
                int tmp = s[i][j] + (i - last[j]) * c[j];
                if(tmp > val){
                    schedule[i] = j;
                    val = tmp;
                }
            }
            last[schedule[i]] = i;
        }
        calcScore();
    }

    void calcScore() {
        score = 0;
        int last[26] = {0};
        for (int d=0; d<D; ++d){
            // Add bonus
            score += s[d][schedule[d]];
            last[schedule[d]] = d + 1;
            // Sub frastration
            for (int i=0; i<26; ++i){
                history[d][i] = last[i];
                score -= c[i] * (d + 1 - last[i]);
            }
        }
    }

    void updateScore(int x, int p, int v) {
        score += s[x][v];
        score -= s[x][p];
        // Update v
        int pval = history[x][v];
        for (int d=x; d<D; ++d){
            if (history[d][v] != pval){
                break;
            }
            score += c[v] * (d + 1 - history[d][v]);
            history[d][v] = x + 1;
            score -= c[v] * (d + 1 - history[d][v]);
        }
        // Update p
        pval = history[x][p];
        int nval = 0;
        if (x != 0){ 
            nval = history[x-1][p];
        }
        for (int d=x; d<D; ++d){
            if (history[d][p] != pval){
                break;
            }
            score += c[p] * (d + 1 - history[d][p]);
            history[d][p] = nval;
            score -= c[p] * (d + 1 - history[d][p]);
        }
    }

    void output(){
        for(int i=0; i<D; ++i){
            cout << schedule[i] + 1;
            printf("\n");
        }
        fflush(stdout);
    }
};

void solve(){
    auto start_cycle = get_cycle();
    double current_time = get_time(start_cycle);
    // Temperature must be > 0.0
    double temp_upper = 100.0;
    double temp_lower = 0.1;
    State state;
    state.init();
    int itr_cnt = 0;
    int p_history[365];
    int v_history[365];
    while(current_time < TIME_LIMIT){
        current_time = get_time(start_cycle);
        double temp = temp_upper + (temp_lower - temp_upper) * current_time * TIME_LIMIT_INV;
        double temp_inv = 1.0 / temp;
        // Each epoch has ITER_PER_EPOCH times iteration
        for(int i=0; i<ITER_PER_EPOCH; i++){
            int x = xrand() % D;
            int v = xrand() % 26;
            if(v == state.schedule[x]){ continue; }
            itr_cnt++;

            // Save previous states
            int score = state.score;
            int prev = state.schedule[x];

            // Update states
            state.schedule[x] = v;
            for (int d=0; d<D; ++d){
                p_history[d] = state.history[d][prev];
                v_history[d] = state.history[d][v];
            }
            state.updateScore(x, prev, v);
            // If you want to hill climb, do transition only with score < state.score.
            if(score < state.score || xrand_uniform() < xexp((state.score - score) * temp_inv)){
            // Transition (keep state)
            }
            else{
            // Rollback state
                state.schedule[x] = prev;
                state.score = score;
                for (int d=x; d<D; ++d){
                    state.history[d][prev] = p_history[d];
                    state.history[d][v] = v_history[d];
                }
            }
        }
    }
    state.output();
    cerr << "iterations: " << itr_cnt << endl;
    cerr << "score: " << state.score << endl;
}

int main(){
    // Input
    cin >> D;
    for (int i=0; i<26; ++i){
        cin >> c[i]; 
    }
    for (int i=0; i<D; ++i){
        for (int j=0; j<26; ++j){
            cin >> s[i][j]; 
        }
    }
    solve();
    return 0;
}

Measured memory_bytes: 3648