#include <bits/stdc++.h>
#define LIMTIME 1900
using namespace std;

unsigned int xorshift() {
  static unsigned int nowx = 123456789, nowy = 362436069, nowz = 521288629,
                      noww = 88675123;
  unsigned int temp;
  temp = (nowx ^ (nowx << 11));
  nowx = nowy;
  nowy = nowz;
  nowz = noww;
  return (noww = (noww ^ (noww >> 19)) ^ (temp ^ (temp >> 8)));
}

long long d, score = -1;
const long long t = 26;
vector<long long> c, res;
vector<vector<long long>> s;
vector<set<int>> st;

void solve();
long long calc();
long long change(int day, int id, bool ch = false);

int main() {
  cin >> d;
  c.resize(t);
  res.resize(d);
  for (auto &p : c) cin >> p;
  s.resize(d, vector<long long>(t, 0));
  for (auto &v : s)
    for (auto &p : v) cin >> p;
  solve();
  calc();
  for (auto p : res) cout << p + 1 << endl;
  return 0;
}

void solve() {
  auto start = chrono::system_clock::now();
  auto nowt = chrono::system_clock::now();
  auto dur = nowt - start;
  auto msec = chrono::duration_cast<chrono::milliseconds>(dur).count();
  long long lim = 19000;
  vector<long long> memo(t, 0);
  for (int i = 0; i < d; ++i) {
    int id = 0;
    for (int j = 0; j < t; ++j)
      if (s[i][id] < s[i][j]) id = j;
    if (s[i][id] >= lim)
      res[i] = id;
    else {
      int cid = 0;
      long long sum = 0;
      for (int j = 0; j < t; ++j) {
        sum += memo[j] + c[j];
        if (memo[j] + c[j] > memo[cid] + c[cid]) cid = j;
      }
      sum -= memo[id] + c[id];
      if (s[i][id] > sum)
        res[i] = id;
      else
        res[i] = cid;
    }
    for (int j = 0; j < t; ++j)
      if (j != res[i])
        memo[j] += c[j];
      else
        memo[j] = 0;
  }
  change(0, res[0], 1);
  for (int i = 0; i < d; ++i) {
    for (int j = 0; j < t; ++j) {
      int bf = res[i];
      long long nows = score;
      if (nows > change(i, j)) change(i, bf);
    }
  }
  nowt = chrono::system_clock::now();
  dur = nowt - start;
  msec = chrono::duration_cast<chrono::milliseconds>(dur).count();
  cerr << msec << endl;
  while (msec < LIMTIME) {
    long long now = score, nowd = xorshift() % d, nowid = xorshift() % t,
              bf = 0;
    bf = res[nowd];
    if (now > change(nowd, nowid)) change(nowd, bf);
    nowt = chrono::system_clock::now();
    dur = nowt - start;
    msec = chrono::duration_cast<chrono::milliseconds>(dur).count();
  }
  cerr << calc() + (1000000) << endl;
}

long long calc() {
  long long sum = 0;
  vector<long long> memo(t, 0);
  for (int i = 0; i < d; ++i) {
    int num = res[i];
    sum += s[i][num];
    for (int j = 0; j < t; ++j)
      if (j != num)
        sum -= (memo[j] += c[j]);
      else
        memo[j] = 0;
  }
  return sum;
}

long long change(int day, int id, bool ch) {
  if (ch) {
    res[day] = id;
    score = calc();
    st.resize(t);
    for (int i = 0; i < t; ++i) st[i].insert(0), st[i].insert(d + 1);
    for (int i = 0; i < d; ++i) st[res[i]].insert(i + 1);
    return score;
  }
  int bf = res[day];
  score -= s[day][bf];
  score += s[day][id];
  st[bf].erase(day + 1);
  auto it = st[bf].upper_bound(day + 1);
  int righ = *it, lef;
  --it;
  lef = *it;
  score += ((righ - day - 1) * (righ - day - 2) +
            (day + 1 - lef) * (day - lef) - (righ - lef) * (righ - lef - 1)) *
           c[bf] / 2;
  it = st[id].upper_bound(day + 1);
  righ = *it;
  --it;
  lef = *it;
  score -= ((righ - day - 1) * (righ - day - 2) +
            (day + 1 - lef) * (day - lef) - (righ - lef) * (righ - lef - 1)) *
           c[id] / 2;
  res[day] = id;
  st[id].insert(day + 1);
  return score;
}


Measured memory_bytes: 3732