#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#pragma GCC diagnostic ignored "-Wunused-result"

#include <cstdio>
#include <chrono>
#include <random>

using namespace std;
using namespace chrono;

constexpr int c_max = 26;
constexpr int D = 365;
constexpr int INF = 1e9;
constexpr int time_limit = 1987;

int c[c_max];
int s[D][c_max];
int best_score[D];
int last[c_max];
int schedule[D];

inline int calc_score(const int &day, const int &examining) {
  int ret;
  if (day == 0) ret = s[day][examining];
  else ret = best_score[day - 1] + s[day][examining];
  
  for (int i = 0; i < c_max; i++) {
    if (i == examining) continue;
    ret -= (day - last[i]) * c[i];
  }

  return ret;
}

inline int calc_score_diff(const int &day1, const int &day2) {
  int prev_interval_backward_1 = 0;
  for (int i = day1 - 1; i >= 0; i--) {
    prev_interval_backward_1++;
    if (schedule[i] == schedule[day1]) break;
  }

  int prev_interval_backward_2 = 0;
  for (int i = day2 - 1; i >= 0; i--) {
    prev_interval_backward_2++;
    if (schedule[i] == schedule[day2]) break;
  }

  int prev_interval_forward_1 = 0;
  for (int i = day1 + 1; i < D; i++) {
    prev_interval_forward_1++;
    if (schedule[i] == schedule[day1]) break;
  }

  int prev_interval_forward_2 = 0;
  for (int i = day2 + 1; i < D; i++) {
    prev_interval_forward_1++;
    if (schedule[i] == schedule[day2]) break;
  }

  int new_interval_backward_1 = 0;
  for (int i = day2 - 1; i >= 0; i--) {
    new_interval_backward_1++;
    if (schedule[i] == schedule[day1]) break;
  }

  int new_interval_backward_2 = 0;
  for (int i = day1 - 1; i >= 0; i--) {
    new_interval_backward_2++;
    if (schedule[i] == schedule[day2]) break;
  }

  int new_interval_forward_1 = 0;
  for (int i = day2 + 1; i < D; i++) {
    new_interval_forward_1++;
    if (schedule[i] == schedule[day1]) break;
  }

  int new_interval_forward_2 = 0;
  for (int i = day1 + 1; i < D; i++) {
    new_interval_forward_1++;
    if (schedule[i] == schedule[day2]) break;
  }

  int ret = s[day1][schedule[day2]] + s[day2][schedule[day1]]
          - s[day1][schedule[day1]] - s[day2][schedule[day2]];
  
  ret += c[schedule[day1]] * (
            prev_interval_backward_1 * (prev_interval_backward_1 + 1) +
            prev_interval_forward_1 * (prev_interval_forward_1 + 1) -
            new_interval_backward_1 * (new_interval_backward_1 + 1) -
            new_interval_forward_1 * (new_interval_forward_1 + 1)
          ) / 2;

  ret -= c[schedule[day2]] * (
            prev_interval_backward_2 * (prev_interval_backward_2 + 1) +
            prev_interval_forward_2 * (prev_interval_forward_2 + 1) -
            new_interval_backward_2 * (new_interval_backward_2 + 1) -
            new_interval_forward_2 * (new_interval_forward_2 + 1)
          ) / 2;

  return ret;
}

int main() {
  system_clock::time_point start = system_clock::now(), now;

  random_device seed;
  mt19937 rnd(seed());

  /* input */
  scanf("%*d");

  for (int i = 0; i < c_max; i++) {
    scanf("%d", &c[i]);
  }

  for (int i = 0; i < D; i++) {
    for (int j = 0; j < c_max; j++) {
      scanf("%d", &s[i][j]);
    }
  }

  /* calc initial solution */
  for (int d = 0; d < D; d++) {
    int best = -INF;
    int contest_to_hold = 0;
    for (int type = 0; type < c_max; type++) {
      int score = calc_score(d, type);
      if (best < score) {
        best = score;
        contest_to_hold = type;
      }
    }
    last[contest_to_hold] = d;
    schedule[d] = contest_to_hold;
  }

  /* try and error */
  int day1, day2, score_diff, tmp;
  while (1) {
    now = system_clock::now();
    if (duration_cast<milliseconds>(now - start).count() > time_limit) break;
    day1 = rnd() % D;
    day2 = rnd() % D;
    score_diff = calc_score_diff(day1, day2);
    if (score_diff > 0) {
      swap(schedule[day1], schedule[day2]);
    }
  }

  /* output */
  for (const int &x : schedule) {
    printf("%d\n", x+1);
  }

  return 0;
}


Measured memory_bytes: 3404