#include <bits/stdc++.h>

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

int D;
vector<int> down;
vector<vector<int>> up;

vector<int> ans;
array<set<int>, 26> opend;

long long xor128() {
    static long long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    long long t;

    t = (x^(x<<11));
    x=y;
    y=z;
    z=w;

    return( w = (w^(w>>19)) ^ (t^(t>>8)) );
}

int all_calculation() {
  int ret = 0;
  for (int d = 0; d < D; ++d) {
    ret += up[d][ans[d]];
    for (int i = 0; i < 26; ++i) {
      int b = *(--opend[i].upper_bound(d));
      ret -= (d - b) * down[i];
    }
  }

  return ret;
}

int calculation_diff(int d, int next) {
  int before = ans[d];
  int b_score = -up[d][before];
  int n_score = up[d][next];

  int b_before = *(--opend[before].lower_bound(d));
  int b_next = *(opend[before].upper_bound(d));
  int n_before = *(--opend[next].upper_bound(d));
  int n_next = *(opend[next].upper_bound(d));

  b_score -= (b_next - b_before - 1) * (b_next - b_before) / 2 * down[before];
  b_score += (b_next - d - 1) * (b_next - d) / 2 * down[before];
  b_score += (d - b_before - 1) * (d - b_before) / 2 * down[before];

  n_score -= (n_next - d - 1) * (n_next - d) / 2 * down[next];
  n_score -= (d - n_before - 1) * (d - n_before) / 2 * down[next];
  n_score += (n_next - n_before - 1) * (n_next - n_before) / 2 * down[next];

  return b_score + n_score;
}

void transition(int d, int next) {
  opend[ans[d]].erase(d);
  opend[next].insert(d);
  ans[d] = next;

  return;
}

void simulated_annealing() {
  constexpr double simulate_time = 1800000;
  constexpr double start_temp = 100;
  constexpr double end_temp = 10;

  clock_t s = clock(), f;

  ans.resize(D);
  for (int d = 0; d < D; ++d) {
    ans[d] = d % 26;
  }
  for (int i = 0; i < 26; ++i) {
    opend[i].insert(-1);
    opend[i].insert(D);
  }
  for (int d = 0; d < D; ++d) {
    opend[ans[d]].insert(d);
  }

  int now_score = all_calculation();
  vector<int> ret_state(D);
  int max_score = now_score;
  int changed_score;
  int diff_score;
  double temp;
  double probability;
  bool force;

  cerr << now_score << endl;
  copy(ALL(ans), ret_state.begin());

  while (f = clock(), f - s < simulate_time) {
    temp = start_temp + (end_temp - start_temp) * (f - s) / simulate_time;
    for (int &&i = 0; i < 100; ++i) {
      static int change_pos;
      static int change_num;
      do {
        change_pos = xor128() % D;
        change_num = xor128() % 26;
      } while (ans[change_pos] == change_num);

      changed_score = now_score + calculation_diff(change_pos, change_num);

      probability = exp((changed_score - now_score*1.0) / temp);
      force = probability > (xor128() % 1000 * 1.0 / 1000.0);
      if (changed_score > now_score || force) {
        now_score = changed_score;
        transition(change_pos, change_num);
        if (now_score > max_score) {
          cerr << now_score << " " << max_score << endl;
          max_score = now_score;
          copy(ALL(ans), ret_state.begin());
        }
      }
    }
  }

  cerr << max_score << endl;
  copy(ALL(ret_state), ans.begin());

  return;
}


int main() {
  cin >> D;
  down.resize(26);
  up.resize(D, vector<int>(26));
  for (auto &in: down) {
    cin >> in;
  }
  for (auto &d: up) {
    for (auto &in: d) {
      cin >> in;
    }
  }

  simulated_annealing();
  for (auto a: ans) {
    cout << a + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 4404