//
// Created on 2020/07/23.
//
//
// Created on 2020/07/21.
//


#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 <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 <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#include <stdio.h>
#include <time.h>


#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;

int d;
vector<int>c(27);
vector<vector<int>>s;
vector<int>c_sum;

inline void InitRand()
{
    srand((unsigned int)time(NULL));
}

int random_max_x(int x){
    return rand() % x + 1;
}
void del_c_score(int date, int contest, vector<vector<int>>& temp_last, vector<int>& temp_c_log, int& temp_score){
    temp_score -= s[date][contest];
    int ok = temp_last[contest].size() - 1;
    int ng = 0;
    int mid = (ok + ng) / 2;
    while(!(abs(ok - ng) == 1)){
        if(temp_last[contest][mid] < date){
            ng = mid;
        }else{
            ok = mid;
        }
        mid = (ok + ng) / 2;
    }
    for (int j = 0; j < temp_last[contest].size() - 1; ++j) {
        temp_score += c_sum[abs((temp_last[contest][j+1] - 1) - temp_last[contest][j])] * c[contest];
    }
    temp_last[contest].erase(temp_last[contest].begin() + ok);
    for (int j = 0; j < temp_last[contest].size() - 1; ++j) {
        temp_score -= c_sum[abs((temp_last[contest][j+1] - 1) - temp_last[contest][j])] * c[contest];
    }
    temp_c_log[date] = -1;
}
void add_c_score(int date, int contest, vector<vector<int>>& temp_last, vector<int>& temp_c_log, int& temp_score){;
    temp_score += s[date][contest];
    for (int j = 0; j < temp_last[contest].size() - 1; ++j) {
        temp_score += c_sum[abs((temp_last[contest][j+1] - 1) - temp_last[contest][j])] * c[contest];
    }
    temp_last[contest].push_back(date);
    sort(all(temp_last[contest]));
    for (int j = 0; j < temp_last[contest].size() - 1; ++j) {
        temp_score -= c_sum[abs((temp_last[contest][j+1] - 1) - temp_last[contest][j])] * c[contest];
    }
    temp_c_log[date] = contest;
}
int main() {

    cin>>d;
    c_sum.resize(d+1);
    int r = 0;
    for (int i = 0; i <= d; ++i) {
        r += i;
        c_sum[i] = r;
    }
    s.resize(d+1,vector<int>(27));
    vector<int>c_log(d+1);
    vector<vector<int>>last(27,vector<int>(1,0));
    for (int i = 1; i <= 26; ++i) {
        cin>>c[i];
    }
    for (int i = 1; i <= d; ++i) {
        for (int j = 1; j <= 26; ++j) {
            cin>>s[i][j];
        }
    }
    int final_score = 0;
    for (int k = 1; k <= d; ++k) {
        vector<int> best = {-INF,0};//score,contest
        for (int j = 0; j < 26; ++j) {
            int temp_score = final_score;
            int t;
            t = j;
            //cin>>t;
            temp_score += s[k][t];
            for (int i = 1; i <= 26; ++i) {
                if(i != t) temp_score -= c[i] * abs(k - last[i][last[i].size()-1]);
            }
            if(temp_score > best[0]){
                best[0] = temp_score;
                best[1] = t;
            }
        }
        last[best[1]].push_back(k);
        final_score = best[0];
        c_log[k] = best[1];
    }
    for (int l = 1; l <= 26; ++l) {
        last[l].push_back(d + 1);
    }

    InitRand();
    int m;
    //cin>>m;
    m = 100000;
    for (int i = 0; i < m; ++i) {
        auto temp_score = final_score;
        auto temp_last = last;
        auto temp_c_log = c_log;

        int mode = random_max_x(2);
        //mode = 1;
        //mode1 => point_change
        //mode2 => swap


        if(mode == 1){
            int c_d,q;
            c_d = random_max_x(d);//変更するひ
            //cin>>c_d;
            int old_c = temp_c_log[c_d];//変更前のコンテスト
            q = random_max_x(26);//変更後のコンテスト
            //cin>>q;
            del_c_score(c_d, old_c,temp_last,temp_c_log,temp_score);
            add_c_score(c_d,q,temp_last,temp_c_log,temp_score);
        }else{
            int c_d_a,c_d_b;
            c_d_a = random_max_x(d);//起点の日
            c_d_b = c_d_a - (random_max_x(26) - 13);//交換する日
            if(1 <=c_d_b && c_d_b <= d){

                int c_a = temp_c_log[c_d_a];
                int c_b = temp_c_log[c_d_b];
                del_c_score(c_d_a,c_a,temp_last,temp_c_log,temp_score);
                del_c_score(c_d_b,c_b,temp_last,temp_c_log,temp_score);
                add_c_score(c_d_a,c_b,temp_last,temp_c_log,temp_score);
                add_c_score(c_d_b,c_a,temp_last,temp_c_log,temp_score);
            }
        }
        if(temp_score > final_score){
            //cout<<i<<endl;
            final_score = temp_score;
            last = temp_last;
            c_log = temp_c_log;
        }
    }
    //cout<<"fnished"<<endl;
    for (int i = 1; i <= d; ++i) {
        cout<<c_log[i]<<endl;
    }

    return 0;
}



Measured memory_bytes: 3716