//
// 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;

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

int random_max_x(int x){
    return rand() % x + 1;
}

int main() {


    int d;
    cin>>d;

    vector<int>c_sum(d+1);
    int r = 0;
    for (int i = 0; i <= d; ++i) {
        r += i;
        c_sum[i] = r;
    }

    vector<int>c(27);
    vector<int>c_log(d+1);
    vector<vector<int>>last(27,vector<int>(1,0));
    vector<vector<int>>s(d+1,vector<int>(27));
    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 = j;
            temp_score += s[k][t];
            for (int i = 0; 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();

    for (int i = 0; i < 100000; ++i) {
        auto temp_score = final_score;
        auto temp_last = last;
        auto temp_c_log = c_log;

        int c_d,q;
        c_d = random_max_x(d);
        q = random_max_x(26);

        int old_c = c_log[c_d];
        temp_score -= s[c_d][old_c];
        temp_score += s[c_d][q];
        int ok = temp_last[old_c].size();
        int ng = 0;
        int mid = (ok + ng) / 2;
        while(!(abs(ok - ng) == 1)){
            if(temp_last[old_c][mid] < c_d){
                ng = mid;
            }else{
                ok = mid;
            }
            mid = (ok + ng) / 2;
        }

        for (int j = 0; j < temp_last[old_c].size() - 1; ++j) {
            temp_score += c_sum[abs((temp_last[old_c][j+1] - 1) - temp_last[old_c][j])] * c[old_c];
        }
        for (int j = 0; j < temp_last[q].size() - 1; ++j) {
            temp_score += c_sum[abs((temp_last[q][j+1] - 1) - temp_last[q][j])] * c[q];

        }
        temp_last[old_c].erase(temp_last[old_c].begin() + ok);
        temp_last[q].push_back(c_d);
        sort(all(temp_last[q]));
        for (int j = 0; j < temp_last[old_c].size() - 1; ++j) {
            temp_score -= c_sum[abs((temp_last[old_c][j+1] - 1) - temp_last[old_c][j])] * c[old_c];

        }
        for (int j = 0; j < temp_last[q].size() - 1; ++j) {
            temp_score -= c_sum[abs((temp_last[q][j+1] - 1) - temp_last[q][j])] * c[q];
        }
        temp_c_log[c_d] = q;
        if(temp_score >= final_score){
            final_score = temp_score;
            last = temp_last;
            c_log = temp_c_log;
        }
    }
    for (int i = 1; i <= d; ++i) {
        cout<<c_log[i]<<endl;
    }

    return 0;
}



Measured memory_bytes: 3688