#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

constexpr int64 CYCLES_PER_SEC = 2800000000;

struct Timer {
  int64 start;

  Timer() { reset(); }

  void reset() { start = getCycle(); }

  inline double get() { return (double) (getCycle() - start) / CYCLES_PER_SEC; }

  inline int64 getCycle() {
    unsigned low, high;
    __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
    return ((int64) low) | ((int64) high << 32);
  }
};

using BIT = bitset< 366 >;

constexpr double TL = 2.09;

inline uint32_t xor128() {
  static uint32_t y = 2463534242;
  y = y ^ (y << 13);
  y = y ^ (y >> 17);
  return y = y ^ (y << 5);
}

inline double exp1(double x) {
  x = 1.0 + x / 256.0;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  return x;
}


int main() {
  Timer timer;

  int D, C[27], S[365][26]; // D: 365
  cin >> D;
  for(int i = 0; i < 26; i++) cin >> C[i];
  for(int i = 0; i < D; i++) {
    for(int j = 0; j < 26; j++) {
      cin >> S[i][j];
    }
  }


  int ret = 0, best_score = -inf;
  int last[26];
  vector< BIT > bit(26), bit_rev(26);
  for(int i = 0; i < 26; i++) {
    last[i] = -1;
    bit[i].set(D);
    bit_rev[i].set(D);
  }
  // 初期解として最良のものを選ぶ
  int T[365], E[365];
  for(int i = 0; i < D; i++) {

    int add_score = -inf, choose = -1;
    for(int j = 0; j < 26; j++) {
      int sub_score = S[i][j];
      for(int k = 0; k < 26; k++) {
        if(j != k) sub_score -= 2 * C[k] * (i - last[k]);
      }
      if(chmax(add_score, sub_score)) choose = j;
    }

    T[i] = xor128() % 26;
    last[T[i]] = i;
    bit[T[i]].set(i);
    bit_rev[T[i]].set(D - 1 - i);
    ret += S[i][T[i]];
    for(int j = 0; j < 26; j++) ret -= C[j] * (i - last[j]);
  }

  // 焼き鈍し法をしてみるか....
  constexpr double start_temp = 3000.0;
  constexpr double end_temp = 10.0;

  timer.reset();
  for(int t = 0;; t++) {
    auto now_time = timer.get();
    if(now_time >= TL) break;

    if((t&3)<=2) {
      int x = xor128() % (365-40);
      int y = x+(xor128() % 39)+1;
      if(T[x] == T[y]) continue;
      int t_x = T[x];
      int t_y = T[y];

      int diff = 0;
      {
        int d = x, q = t_y;
        diff -= S[d][T[d]];
        int pre_diff = (int) bit_rev[T[d]]._Find_next(D - 1 - d) - (D - 1 - d);
        int nxt_diff = (int) bit[T[d]]._Find_next(d) - d;
        diff -= pre_diff * nxt_diff * C[T[d]];

        bit[T[d]].reset(d);
        bit_rev[T[d]].reset(D - 1 - d);
        T[d] = q;
        bit[T[d]].set(d);
        bit_rev[T[d]].set(D - 1 - d);

        diff += S[d][q];
        pre_diff = (int) bit_rev[q]._Find_next(D - 1 - d) - (D - 1 - d);
        nxt_diff = (int) bit[q]._Find_next(d) - d;
        diff += pre_diff * nxt_diff * C[q];
      }

      {
        int d = y, q = t_x;

        diff -= S[d][T[d]];
        int pre_diff = (int) bit_rev[T[d]]._Find_next(D - 1 - d) - (D - 1 - d);
        int nxt_diff = (int) bit[T[d]]._Find_next(d) - d;
        diff -= pre_diff * nxt_diff * C[T[d]];

        bit[T[d]].reset(d);
        bit_rev[T[d]].reset(D - 1 - d);
        T[d] = q;
        bit[T[d]].set(d);
        bit_rev[T[d]].set(D - 1 - d);

        diff += S[d][q];
        pre_diff = (int) bit_rev[q]._Find_next(D - 1 - d) - (D - 1 - d);
        nxt_diff = (int) bit[q]._Find_next(d) - d;
        diff += pre_diff * nxt_diff * C[q];
      }

      double prob = exp1(diff / (start_temp + (end_temp - start_temp) * now_time / TL));

      if(prob > (xor128() % inf) / (double) inf) {
        ret += diff;
        if(best_score < ret) {
          best_score = ret;
          memcpy(E, T, sizeof(T));
        }
      } else {
        T[x] = t_x;
        T[y] = t_y;
        bit[T[x]].reset(y);
        bit[T[y]].reset(x);
        bit[T[x]].set(x);
        bit[T[y]].set(y);
        bit_rev[T[x]].reset(D - 1 - y);
        bit_rev[T[y]].reset(D - 1 - x);
        bit_rev[T[x]].set(D - 1 - x);
        bit_rev[T[y]].set(D - 1 - y);
      }

    } else {
      int d = xor128() % 365;
      int q = xor128() % 26;
      if(T[d] == q) continue;

      int diff = 0;

      diff -= S[d][T[d]];
      int pre_diff = (int) bit_rev[T[d]]._Find_next(D - 1 - d) - (D - 1 - d);
      int nxt_diff = (int) bit[T[d]]._Find_next(d) - d;
      diff -= pre_diff * nxt_diff * C[T[d]];
      diff += S[d][q];
      pre_diff = (int) bit_rev[q]._Find_next(D - 1 - d) - (D - 1 - d);
      nxt_diff = (int) bit[q]._Find_next(d) - d;
      diff += pre_diff * nxt_diff * C[q];

      double prob = exp1(diff / (start_temp + (end_temp - start_temp) * now_time / TL));

      if(prob > (xor128() % inf) / (double) inf) {
        ret += diff;
        bit[T[d]].reset(d);
        bit_rev[T[d]].reset(D - 1 - d);
        T[d] = q;
        bit[T[d]].set(d);
        bit_rev[T[d]].set(D - 1 - d);
        if(best_score < ret) {
          best_score = ret;
          memcpy(E, T, sizeof(T));
        }
      }
    }
  }

  for(int i = 0; i < D; i++) cout << E[i] + 1 << "\n";
}



Measured memory_bytes: 3664