#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

int get_random(int l, int r) {
  int k = r - l + 1;
  return l + rng() % k;
}

const int N = 365 + 7;
const int K = 26 + 7;
int n;
int c[K], s[N][K], t[N], last[K], sol[N], best = -(int) 2e9, univ;
set<int> pos[K];

void put_univ() {
  univ = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 26; j++) {
      univ -= c[j] * i;
    }
  }
  for (int j = 1; j <= 26; j++) {
    pos[j].clear();
    pos[j].insert(0);
    pos[j].insert(n + 1);
    last[j] = 0;
  }
  for (int i = 1; i <= n; i++) {
    pos[t[i]].insert(i);
  }
  int grow = 0;
  for (int i = 1; i <= n; i++) {
    univ += s[i][t[i]];
    grow += c[t[i]] * (i - last[t[i]]);
    last[t[i]] = i;
    univ += grow;
  }
}

void upd_univ(int i, int x) {
  univ -= s[i][t[i]];
  univ += s[i][x];
  auto it = pos[t[i]].lower_bound(i + 1);
  auto ant = it;
  ant--;
  ant--;
  int init = univ;
  univ -= c[t[i]] * i * (*it - i);
  univ += c[t[i]] * (*ant) * (*it - i);

  it = pos[x].lower_bound(i + 1);
  ant = it;
  ant--;
  univ -= c[x] * (*ant) * (*it - i);
  univ += c[x] * i * (*it - i);

  pos[t[i]].erase(i);
  pos[x].insert(i);
  t[i] = x;
}

void upd() {
  put_univ();
  if (univ > best) {
    best = univ;
    for (int i = 1; i <= n; i++) {
      sol[i] = t[i];
    }
  }
}

void make_better(double seconds) {
  time_t bg = clock();
  int c = 0;
  while (1) {
    c++;
    if (c % 10 == 0) {
      time_t nd = clock();
      if ((double) (nd - bg) / CLOCKS_PER_SEC > seconds) {
        break;
      }
    }
    int i = get_random(1, n), x = get_random(1, 26);
    while (x == t[i]) {
      x = get_random(1, 26);
    }
    int init = t[i];
    t[i] = x;
    int cur = univ;
    upd_univ(i, x);
    int after = univ;
    if (after > cur) {
      cur = after;
    } else {
      upd_univ(i, init);
    }
  }
  upd();
}

void generate_max() {
  for (int i = 1; i <= n; i++) {
    t[i] = 1;
    for (int j = 1; j <= 26; j++) {
      if (s[i][j] > s[i][t[i]]) {
        t[i] = j;
      }
    }
  }
  put_univ();
}

void generate_random(int cnt) {
  generate_max();
  int modif = get_random(1, cnt);
  while (modif--) {
    int i = get_random(1, n), x = get_random(1, 26);
    while (t[i] == x) {
      x = get_random(1, 26);
    }
    t[i] = x;
  }
  put_univ();
}

void generate_random2(int cnt) {
  t[1] = 1;
  for (int j = 1; j <= 26; j++) {
    if (c[j] > c[t[1]]) {
      t[1] = j;
    }
  }
  for (int i = 2; i <= n; i++) {
    t[i] = t[1];
  }
  int modif = get_random(1, cnt);
  while (modif--) {
    int i = get_random(1, n), x = get_random(1, 26);
    while (t[i] == x) {
      x = get_random(1, 26);
    }
    t[i] = x;
  }
  put_univ();
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= 26; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 26; j++) {
      cin >> s[i][j];
    }
  }
  for (int i = 1; i <= 150; i++) {
    generate_random(i);
    make_better(0.01);
    upd();
  }
  for (int i = 1; i <= 15; i++) {
    generate_random2(i);
    make_better(0.01);
    upd();
  }
  generate_max();
  make_better(0.2);
  upd();
  for (int i = 1; i <= n; i++) {
    cout << sol[i] << "\n";
  }
  return 0;
}


Measured memory_bytes: 3748