#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cmath> // fabs, pow, sqrt, sin, fmod
#include <chrono> // system_clock 
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <random>

using namespace std;
using namespace chrono;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    system_clock::time_point  start, end; //時間計測用

    start = chrono::system_clock::now(); //計測開始

    int D;
    cin >> D;

    vector<int> c(26);
    rep(i, 26) {
        cin >> c.at(i);
    }

    vector<vector<int>> s(D, vector<int>(26));
    rep(d, D) {
        rep(i, 26) {
            cin >> s.at(d).at(i);
        }
    }

    vector<int> t(D); //その日に選んだコンテスト

    //スコア計算
    int score = 0;

    vector<int> last(26);
    rep(i,26) last[i]= -1;

    rep(d, D) { //d:day
        int max_t = 1;
        int max_score = 0;

        rep(i, 26) { //i:contest
            int tmp_score = score;
            vector<int> tmp_last = last;
            t[d] = i;
            tmp_last[t.at(d)] = d;
            tmp_score += s[d][t[d]];
            rep(j, 26) { 
                tmp_score -= c[j] * (d - tmp_last[j]);
            }
            if(max_score < tmp_score) {
                max_t = i;
                max_score = tmp_score;
            }
        }
        t[d] = max_t;
        last[max_t] = d;
        score = max_score;
    }

    end = chrono::system_clock::now();
    double elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();

    while(elapsed < 1950) {
        int choose = rand()%2;

        //1点変更
        if(choose == 0) {
            int change_d = rand()%D;
            int change_t = rand()%26;
            int before_t = t[change_d];
            int tmp_score = score;

            tmp_score -= s[change_d][before_t];
            tmp_score += s[change_d][change_t];

            int tmp_last_before = -1;
            int tmp_last_after = -1;

            rep(d, D) {            
                if(before_t == t[d]) {
                    if(change_d != d) {
                        tmp_last_after = d;
                    }
                    tmp_last_before = d;               
                } 
                tmp_score += c[before_t] * (d - tmp_last_before);
                tmp_score -= c[before_t] * (d - tmp_last_after);
            }

            tmp_last_before = -1;
            tmp_last_after = -1;

            rep(d, D) { 
                if(change_d == d) {
                    tmp_last_after = d;
                }           
                if(change_t == t[d]) {
                    tmp_last_before = d;     
                    tmp_last_after = d;          
                } 
                tmp_score += c[change_t] * (d - tmp_last_before);
                tmp_score -= c[change_t] * (d - tmp_last_after);
            }

            if(tmp_score > score) {
                score = tmp_score;
                t[change_d] = change_t;
            }
        }

        //2点スワップ
        else {
            int change_d1 = rand()%D;
            int change_d2 = change_d1 -16 + rand()%32;
            if(change_d1 == change_d2 || change_d2 < 0 || change_d2 > D-1) {    
            } else {
                int before_t1 = t[change_d1];
                int before_t2 = t[change_d2];
                int tmp_score = score;       
                tmp_score -= ( s[change_d1][before_t1] + s[change_d2][before_t2] );
                tmp_score += ( s[change_d1][before_t2] + s[change_d2][before_t1] );

                int tmp1_last_before = -1;
                int tmp2_last_before = -1;
                int tmp1_last_after = -1;
                int tmp2_last_after = -1;

                rep(d, D) {
                    if(change_d2 == d) {
                        tmp1_last_after = d;
                    }            
                    if(before_t1 == t[d]) {
                        if(change_d1 != d) {
                            tmp1_last_after = d;
                        }
                        tmp1_last_before = d;               
                    } 
                    tmp_score += c[before_t1] * (d - tmp1_last_before);
                    tmp_score -= c[before_t1] * (d - tmp1_last_after);
                }

                rep(d, D) {
                    if(change_d1 == d) {
                        tmp2_last_after = d;
                    }            
                    if(before_t2 == t[d]) {
                        if(change_d2 != d) {
                            tmp2_last_after = d;
                        }
                        tmp2_last_before = d;               
                    } 
                    tmp_score += c[before_t2] * (d - tmp2_last_before);
                    tmp_score -= c[before_t2] * (d - tmp2_last_after);
                }


                if(tmp_score > score) {
                    score = tmp_score;
                    t[change_d1] = before_t2;
                    t[change_d2] = before_t1;
                }
            }
        }                        

        end = chrono::system_clock::now();
        elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
    }

    rep(d, D) {
        cout << t[d]+1 << endl;
    }
    
}

Measured memory_bytes: 3244