#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <chrono>
#include <cstdio>
#include <iostream>
using namespace std;

unsigned int xor128() {
    static unsigned int x=123456789, y=362436069, z=521288629, w=88675123;
    unsigned int t;
    t=(x^(x<<11)); x=y; y=z; z=w;
    return (w=(w^(w>>19))^(t^(t>>8)));
}

inline bool rand_bool(double prob) {
    constexpr double x = 1LL<<32; // uint_max+1
    return xor128() < prob * x;
}

int timelimit = 2 * 1000, elapsed = 0, margin = 20;

class Timer {
  chrono::system_clock::time_point start_time = chrono::system_clock::now();
public:
  Timer() {}
  int get_elapsed_time() {
    auto diff = chrono::system_clock::now() - start_time;
    return chrono::duration_cast<chrono::milliseconds>(diff).count();
  }
} timer;


const int D = 365;
int c[26], s[D][26];

long long calc_score(int *ans) {
    long long score = 0;
    int last[26] = {};
    fill(last, last+26, -1);
    for (int d = 0; d < D; d++) {
        score += s[d][ans[d]];
        last[ans[d]] = d;
        for (int i = 0; i < 26; i++)
            score -= c[i] * (d - last[i]);
    }
    return score;
}

long long greedy(int *ans) {
    long long score = 0;
    int last[26] = {};
    fill(last, last+26, -1);
    for (int d = 0; d < D; d++) {
        long long max_inc = -(1LL<<60);
        int best_type = -1;
        for (int i = 0; i < 26; i++) {
            long long inc = s[d][i];
            for (int j = 0; j < 26; j++)
                if (j != i) inc -= c[j] * (d - last[j]);
            if (max_inc < inc) {
                max_inc = inc;
                best_type = i;
            }
        }
        ans[d] = best_type;
        last[best_type] = d;
        score += max_inc;
    }
    return score;
}

int csum[26], C;
int cnt[26];

inline int choose_type() {
    int i = xor128()%C;
    int j = lower_bound(csum, csum+26, i) - csum;
    cnt[j]++;
    return j;
}

int main(int argc, char **argv) {
    if (argc > 1) timelimit = atoi(argv[1]) * 1000;
    scanf("%*d");
    for (int i = 0; i < 26; i++) cin >> c[i];
    for (int i = 0; i < 26; i++) csum[i] = c[i] + (i > 0 ? csum[i-1] : 0) + 10;
    C = csum[25];
    for (int d = 0; d < D; d++)
        for (int i = 0; i < 26; i++) cin >> s[d][i];

    int ans[D];
    long long best_score = greedy(ans);
    int iter = 0;
    int best_ans[D];
    copy(ans, ans+D, best_ans);
    while (timer.get_elapsed_time() + margin < timelimit) {
        int d = xor128()%D;
        int i = choose_type();
        int save = ans[d];
        ans[d] = i;
        long long score = calc_score(ans);
        bool update = best_score <= score;
        if (!update) {
            const double r = 1 - double(timer.get_elapsed_time()) / timelimit,
                temp = r * 1000,
                prob = exp((score - best_score) / temp);
            update = rand_bool(prob);
        }
        if (best_score < score) {
            // cerr << iter << ' ' << best_score << " " << score <<endl;
            best_score = score;
            copy(ans, ans+D, best_ans);
        }
        if (update) {
            // 
        } else {
            ans[d] = save;
        }
        iter++;
    }
    cerr << iter << endl;

    for (int d = 0; d < D; d++) cout << best_ans[d] + 1 << endl;
}


Measured memory_bytes: 3912