#include <cassert>
#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];

int greedy(int *ans) {
    int score = 0;
    int last[26] = {};
    fill(last, last+26, -1);
    for (int d = 0; d < D; d++) {
        int max_inc = -(1<<30);
        int best_type = -1;
        for (int i = 0; i < 26; i++) {
            int 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;

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

inline int T(int x) { return x * (x - 1) / 2; }

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];
    int score = greedy(ans);
    int iter = 0;
    int best_ans[D], best_score = score;
    copy(ans, ans+D, best_ans);
    const double start_temp = 1750;
    double temp = start_temp;
    while (timer.get_elapsed_time() + margin < timelimit) {
        if ((iter & ((1<<15) - 1)) == 0) {
            double r = 1 - double(timer.get_elapsed_time()) / timelimit;
            temp = r * start_temp;
        }
        int d = xor128()%D;
        int i = choose_type();
        int save = ans[d];
        ans[d] = i;
        int diff = 0;
        diff += s[d][i] - s[d][save];
        {
            int dp = -1, dn = D;
            for (int x = d-1; x >= 0; x--)
                if (ans[x] == i) { dp = x; break; }
            for (int x = d+1; x < D; x++)
                if (ans[x] == i) { dn = x; break; }
            diff -= c[i] * (T(dn - d) + T(d - dp) - T(dn - dp));
        }
        {
            int dp = -1, dn = D;
            for (int x = d-1; x >= 0; x--)
                if (ans[x] == save) { dp = x; break; }
            for (int x = d+1; x < D; x++)
                if (ans[x] == save) { dn = x; break; }
            diff += c[save] * (T(dn - d) + T(d - dp) - T(dn - dp));
        }
        int tmp_score = score + diff;
        bool update = diff >= 0;
        if (!update && diff > -10 * temp) {
            const double prob = exp(diff / temp);
            update = rand_bool(prob);
        }
        if (best_score < tmp_score) {
            // cerr << iter << ' ' << best_score << " " << score <<endl;
            best_score = tmp_score;
            copy(ans, ans+D, best_ans);
        }
        if (update) {
            score = tmp_score;
        } else {
            ans[d] = save;
        }
        iter++;
    }
    cerr << iter << ' ' << best_score << endl;

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


Measured memory_bytes: 3828