#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <iomanip>
#include <sys/time.h>
#include <random>
#include <cassert>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int, int> P;

class Timer{
protected:
    double startTime;
    double limit;
    bool alreadyTimeup;
public:
    Timer(double timeLimit){
        set(timeLimit);
    }
    void set(double time_limit){
        limit = time_limit;
        startTime = now();
        alreadyTimeup = false;
    }
    bool timeup(){
        if(alreadyTimeup) return true;
        if(now() - startTime > limit){
            alreadyTimeup = true;
            return true;
        }else{
            return false;
        }
    }
    double elapse(){
        return now() - startTime;
    }
    double used(){
        return elapse() / limit;
    }
protected:
    double now(){
        timeval tv;
        gettimeofday(&tv, 0);
        return tv.tv_sec + tv.tv_usec * 1e-6;
    }
};


Timer timer(1.95);
mt19937 rand_gen(1000012);


int get_scores(vector<int>& c, vector<vector<int>>& s, vector<int>& t, int D){
    vector<int> las(26, -1);
    int score = 0;
    for(int i = 0; i < D; i++){
        int contest = t[i];
        int up = s[i][contest];
        int down = 0;
        las[contest] = i;
        for(int j = 0; j < 26; j++){
            down += c[j] * (i - las[j]);
        }
        score += (up - down);
    }
    return score;
}

void make_info1(int j, vector<int>& t, vector<vector<int>>& res1, int D){
    for(int i = 1; i < D; i++){
        if(j == t[i-1]){
            res1[i][j] = i-1;
        }
        else{
            res1[i][j] = res1[i-1][j];
        }
    }
}

void make_info2(int j, vector<int>& t, vector<vector<int>>& res2, int D){
    for(int i = D-2; i >= 0; i--){
        if(j == t[i+1]){
            res2[i][j] = i+1;
        }
        else{
            res2[i][j] = res2[i+1][j];
        }
    }
}

void make_info(vector<int>& t, int D, vector<vector<int>>& res1, vector<vector<int>>& res2){
    for(int j = 0; j < 26; j++){
        make_info1(j, t, res1, D);
    }

    for(int j = 0; j < 26; j++){
        make_info2(j, t, res2, D);
    }
}


int get_dif(int d, int q, vector<int>& c, vector<vector<int>>& s, vector<int>& t, vector<vector<int>>& before, vector<vector<int>>& after, int D){
    int dif1 = s[d][q] - s[d][t[d]];

    int bef1 = before[d][q];
    int nex1 = after[d][q];
    int up1 = (d - bef1) * c[q] * (nex1 - d);

    int bef2 = before[d][t[d]];
    int nex2 = after[d][t[d]];
    int down1 = (d - bef2) * c[t[d]] * (nex2 - d);

    int dif2 = up1 - down1;

    return dif1 + dif2;
}

std::random_device rd;
std::mt19937 mt(rd());

int main(){
    int D;  cin >> D;
    vector<int> c(26);
    for(int i = 0; i < 26; i++) cin >> c[i];
    vector<vector<int>> s(D, vector<int>(26));

    vector<P> cList;
    for(int i = 0; i < 26; i++){
        cList.push_back(P(c[i], i));
    }
    sort(cList.begin(), cList.end());
    reverse(cList.begin(), cList.end());

    for(int i = 0; i < D; i++){
        for(int j = 0; j < 26; j++){
            cin >> s[i][j];
        }
    }

    vector<int> t(D);
    for (int i = 0; i < D; i++) {
        int cur = -1, ma = 0;
        for(int j = 0; j < 26; j++){
            if(ma < s[i][j]){
                cur = j;
                ma = s[i][j];
            }
        }
        t[i] = cur;
    }

    int score = get_scores(c, s, t, D);
    while(true) {
        double time_used = timer.used();
        if (time_used >= 1.0 - 1e-11) {
            break;
        }

        vector<vector<int>> before(D, vector<int>(26, -1));
        vector<vector<int>> after(D, vector<int>(26, D));
        make_info(t, D, before, after);

        int p = mt() % 2;
        int q, d = (mt() + mt()) % D;;
        if(p == 0){
            int x = mt() % 5;
            q = cList[x].sc;
            int dNum = 0;
            for(int i = 0; i < D; i++) {
                int af = after[i][q];
                int bef = before[i][q];

                if(t[i] != q && dNum < (af - bef)){
                    dNum = af - bef;
                    int u = mt() % 5;
                    d = (af + bef) / 2 + u - 2;
                    d = max(d, 0);
                    d = min(d, D-1);
                }
            }

        }
        else{
            q = (mt() + mt()) % 26;
        }

        int dif = get_dif(d, q, c, s, t, before, after, D);
        score += dif;
        if(dif > 0){
            int before_q = t[d];
            t[d] = q;
            make_info1(q, t, before, D);
            make_info2(q, t, after, D);
            make_info1(before_q, t, before, D);
            make_info2(before_q, t, after, D);
        }
    }

    for(auto x: t){
        cout << x + 1 << endl;
    }


    return 0;
}


Measured memory_bytes: 3756