#include <bits/stdc++.h>
#define LIMTIME 1980
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 = 15000;
  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);
  const double sttemp = 0, endtemp = 0;
  const int inf = 2e9;
  while (msec < LIMTIME) {
    long long dl = xorshift() % d, dr = xorshift() % d, now = score, tmp;
    tmp = res[dl];
    double temp = sttemp + (endtemp - sttemp) * msec / LIMTIME;
    if (xorshift() % 3 == 0) {
      double prob = exp((change(dl, xorshift() % t) - now) / temp);
      if (prob <= (xorshift() % inf) / (double)inf) change(dl, tmp);
    } else {
      change(dl, res[dr]);
      double prob = exp((change(dr, tmp) - now) / temp);
      if (prob <= (xorshift() % inf) / (double)inf) {
        change(dr, res[dl]);
        change(dl, tmp);
      }
    }
    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: 3972