#include <algorithm>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long int;
using ld = long double;
#define rep(i,n) for(int i=0; i<n; i++)
#define repm(i,s,n) for(int i=s; i<n; i++)


int DAY = 365;
int TYPE = 26;
int C[40];
int S[400][40];

// ----------------------------------------------------------------
// Simulated Annealing
// ----------------------------------------------------------------
clock_t START_TIME;
unsigned int TIME_BUFFER = 30000;
unsigned int TIME_LIMIT = 2000000 - TIME_BUFFER;
ld START_TEMP = 10000;
ld END_TEMP = 20;

struct STATE {
    ll score;
    
    vector<int> type;
    vector<int> c_weight;
};

void init (STATE& state){
    state.score = 0;
    
    state.type = vector<int>(DAY, 0);
    state.c_weight = vector<int>(TYPE, 0);
    
    vector<int> last(TYPE, -1);
    for(int d=0; d<DAY; d++){
        int S_max = 0, T_max = 0;
        for(int t=0; t<TYPE; t++) if(S_max < S[d][t]) {S_max = S[d][t]; T_max = t;}
        
        last[T_max] = d;
        state.score += (ll)S_max;
        state.type[d] = T_max;
        for(int t=0; t<TYPE; t++) state.c_weight[t] += d - last[t];
    }
    for(int t=0; t<TYPE; t++) state.score -= (ll)C[t] * (ll)state.c_weight[t];
}

void modify (STATE& state){
    
    int day = rand() / (RAND_MAX / DAY+1);
    int type = rand() / (RAND_MAX / TYPE+1);
    int pre_type = state.type[day];
    
    state.score -= (ll)S[day][pre_type];
    state.score += (ll)C[type] * (ll)state.c_weight[type];
    state.score += (ll)C[pre_type] * (ll)state.c_weight[pre_type];
    
    state.type[day] = type;
    state.c_weight[type] = 0;
    state.c_weight[pre_type] = 0;
    int pre_last = -1, last = -1;
    for(int d=0; d<DAY; d++){
        if(state.type[d] == type) last = d;
        if(state.type[d] == pre_type) pre_last = d;
        state.c_weight[type] += d - last;
        state.c_weight[pre_type] += d - pre_last;
    }
    
    state.score += (ll)S[day][type];
    state.score -= (ll)C[type] * (ll)state.c_weight[type];
    state.score -= (ll)C[pre_type] * (ll)state.c_weight[pre_type];
}

ll calc_score (STATE& state){
    return state.score;
}

ld calc_temp (ld now, int type){
    ld t = (ld)(now-START_TIME) / (ld)TIME_LIMIT;
    
    ld temp;
    switch (type) {
        case 1:
            temp = (1-t) * START_TEMP + t * END_TEMP;
        case 2:
            temp = pow(START_TEMP, 1-t) * pow(END_TEMP, t);
        default:
            temp = pow(START_TEMP, 1-t) * pow(END_TEMP, t);
    }
    return temp;
}

void simulated_annealing (){
    
    STATE state;
    init(state);
    
    while (true) {
        ld now_time = clock();
        if (now_time - START_TIME > TIME_LIMIT) break;

        STATE new_state = state;
        modify(new_state);
        ll new_score = calc_score(new_state);
        ll pre_score = calc_score(state);

        ld temp = calc_temp(now_time, 0);
        ld prob = exp((new_score-pre_score)/temp);

        if (prob > (rand()%RAND_MAX)/(double)RAND_MAX) state = new_state;
    }
    
    for(int d=0; d<DAY; d++) cout << state.type[d] + 1 << endl;
}
// ----------------------------------------------------------------

int main() {
    
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    
    START_TIME = clock();
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> DAY;
    rep(i, TYPE) cin >> C[i];
    rep(i, DAY) {rep(j, TYPE) cin >> S[i][j];}

    simulated_annealing();
    return 0;
}


Measured memory_bytes: 3840