#pragma region kyopro_template
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define each(x, v) for (auto &x : v)
#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define mem(a, val) memset(a, val, sizeof(a))
#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)
#define inl(...)         \
  long long __VA_ARGS__; \
  in(__VA_ARGS__)
#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__)
#define inc(...)    \
  char __VA_ARGS__; \
  in(__VA_ARGS__)
#define in2(s, t)                           \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i]);                         \
  }
#define in3(s, t, u)                        \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i], u[i]);                   \
  }
#define in4(s, t, u, v)                     \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i], u[i], v[i]);             \
  }
#define rep(i, N) for (long long i = 0; i < (long long)(N); i++)
#define repr(i, N) for (long long i = (long long)(N)-1; i >= 0; i--)
#define rep1(i, N) for (long long i = 1; i <= (long long)(N); i++)
#define repr1(i, N) for (long long i = (N); (long long)(i) > 0; i--)
using namespace std;
void solve();
using ll = long long;
template <class ll = ll>
using V = vector<ll>;
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vector<int>>;
using vd = V<double>;
using vs = V<string>;
using vvl = vector<vector<long long>>;
using P = pair<long long, long long>;
using vp = vector<P>;
using pii = pair<int, int>;
using vpi = vector<pair<int, int>>;
constexpr int inf = 1001001001;
constexpr long long infLL = (1LL << 61) - 1;
template <typename ll, typename U>
inline bool amin(ll &x, U y) {
  return (y < x) ? (x = y, true) : false;
}
template <typename ll, typename U>
inline bool amax(ll &x, U y) {
  return (x < y) ? (x = y, true) : false;
}
template <typename ll, typename U>
ll ceil(ll a, U b) {
  return (a + b - 1) / b;
}
constexpr ll TEN(int n) {
  ll ret = 1, x = 10;
  while (n) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
}

template <typename ll, typename U>
ostream &operator<<(ostream &os, const pair<ll, U> &p) {
  os << p.first << " " << p.second;
  return os;
}
template <typename ll, typename U>
istream &operator>>(istream &is, pair<ll, U> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename ll>
ostream &operator<<(ostream &os, const vector<ll> &v) {
  int s = (int)v.size();
  for (int i = 0; i < s; i++) os << (i ? " " : "") << v[i];
  return os;
}
template <typename ll>
istream &operator>>(istream &is, vector<ll> &v) {
  for (auto &x : v) is >> x;
  return is;
}
void in() {}
template <typename ll, class... U>
void in(ll &t, U &... u) {
  cin >> t;
  in(u...);
}
void out() { cout << "\n"; }
template <typename ll, class... U>
void out(const ll &t, const U &... u) {
  cout << t;
  if (sizeof...(u)) cout << " ";
  out(u...);
}
template <typename ll>
void die(ll x) {
  out(x);
  exit(0);
}

#ifdef NyaanDebug
#include "NyaanDebug.h"
#define trc(...)                   \
  do {                             \
    cerr << #__VA_ARGS__ << " = "; \
    dbg_out(__VA_ARGS__);          \
  } while (0)
#define trca(v, N)       \
  do {                   \
    cerr << #v << " = "; \
    array_out(v, N);     \
  } while (0)
#define trcc(v)                             \
  do {                                      \
    cerr << #v << " = {";                   \
    each(x, v) { cerr << " " << x << ","; } \
    cerr << "}" << endl;                    \
  } while (0)
#else
#define trc(...)
#define trca(...)
#define trcc(...)
int main() { solve(); }
#endif

struct IoSetupNya {
  IoSetupNya() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(7);
  }
} iosetupnya;

inline int popcnt(unsigned long long a) { return __builtin_popcountll(a); }
inline int lsb(unsigned long long a) { return __builtin_ctzll(a); }
inline int msb(unsigned long long a) { return 63 - __builtin_clzll(a); }
template <typename ll>
inline int getbit(ll a, int i) {
  return (a >> i) & 1;
}
template <typename ll>
inline void setbit(ll &a, int i) {
  a |= (1LL << i);
}
template <typename ll>
inline void delbit(ll &a, int i) {
  a &= ~(1LL << i);
}
template <typename ll>
int lb(const vector<ll> &v, const ll &a) {
  return lower_bound(begin(v), end(v), a) - begin(v);
}
template <typename ll>
int ub(const vector<ll> &v, const ll &a) {
  return upper_bound(begin(v), end(v), a) - begin(v);
}
template <typename ll>
vector<ll> mkrui(const vector<ll> &v) {
  vector<ll> ret(v.size() + 1);
  for (int i = 0; i < int(v.size()); i++) ret[i + 1] = ret[i] + v[i];
  return ret;
};
template <typename ll>
vector<ll> mkuni(const vector<ll> &v) {
  vector<ll> ret(v);
  sort(ret.begin(), ret.end());
  ret.erase(unique(ret.begin(), ret.end()), ret.end());
  return ret;
}
template <typename F>
vector<int> mkord(int N, F f) {
  vector<int> ord(N);
  iota(begin(ord), end(ord), 0);
  sort(begin(ord), end(ord), f);
  return ord;
}
template <typename ll = int>
vector<ll> mkiota(int N) {
  vector<ll> ret(N);
  iota(begin(ret), end(ret), 0);
  return ret;
}

#pragma endregion

constexpr int MOD = /** 998244353;  //*/ 1000000007;

namespace Simulated_Annealing {

// timer
struct Timer {
  chrono::high_resolution_clock::time_point st;

  Timer() { reset(); }

  void reset() { st = chrono::high_resolution_clock::now(); }

  chrono::milliseconds::rep elapsed() {
    auto ed = chrono::high_resolution_clock::now();
    return chrono::duration_cast<chrono::milliseconds>(ed - st).count();
  }
};

// random number generator
unsigned long long rng() {
  static unsigned long long x_ = 88172645463325252ULL;
  x_ = x_ ^ (x_ << 7);
  return x_ = x_ ^ (x_ >> 9);
}

// exp高速化用のlogテーブル
// exp(d/T) > rng()  <=>  d > T * log(rng)を使い前計算
struct gen_log {
  double l[65536];
  constexpr gen_log() : l() {
    unsigned long long x = 88172645463325252ULL;
    double log_u64max = log(2) * 64;
    for (int i = 0; i < 65536; i++) {
      x = x ^ (x << 7);
      x = x ^ (x >> 9);
      l[i] = log(double(x)) - log_u64max;
    }
  }
};
auto rnd_log = gen_log();

// 時間
constexpr double start_time = 0;
constexpr double end_time = 1900;
constexpr double inv_time = 1.0 / (end_time - start_time);
double cur_time = 0;

// 温度 開始温度は実行時に渡す
constexpr double end_temp = 1;
double cur_temp;

// スコア
using score_t = long long;
score_t score = 0, diff = 0;

// 入力用,答え用変数
constexpr int D = 365;
int C[26], S[D][26];
int ans[D];

vi dat[26];

// 入力
void input() {
  ini(dummy);
  rep(i, 26) in(C[i]);
  rep(i, D) rep(j, 26) in(S[i][j]);
}

// 出力
void output() { rep(i, D) cout << (ans[i] + 1) << "\n"; }

// 初期解を構築してスコアを計算
void init() {
  rep(i, 26) dat[i].clear();
  rep(i, 26) dat[i].push_back(-1);

  score = 0;
  // 貪欲
  vl v(26);
  rep(i, D) {
    rep(j, 26) { v[j] = S[i][j] + C[j] * (i - dat[j].back()); }
    int mx = max_element(all(v)) - begin(v);
    ans[i] = mx;
    dat[ans[i]].push_back(i);
    rep(j, 26) {
      if (ans[i] == j)
        score += S[i][j];
      else
        score -= C[j] * (i - dat[j].back());
    }
  }
  rep(i, 26) dat[i].push_back(D);
}

// 状態変数(古い状態と新しい状態をメモする用)
int mode = 0;  // 遷移のパターン用の変数
int d, old, nxt;

// 遷移先を設定
void set_state(int iter) {
  mode = iter % 1;
  if (mode == 0) {
    d = rng() % D;
    old = ans[d];
    do {
      nxt = rng() % 26;
    } while (old == nxt);
  }
}

int on, nn;

void calc_diff() {
  if (mode == 0) {
    //trc(d,old,nxt);
    diff = 0;
    vi &ov = dat[old];
    on = lb(ov, d);
    diff += (ov[on - 1] - ov[on]) * (ov[on + 1] - ov[on]) * C[old];
    diff -= S[d][old];
    //trc(ov, on);
    assert(ov[on] == d);

    vi &nv = dat[nxt];
    nn = lb(nv, d);
    diff -= (nv[nn - 1] - d) * (nv[nn] - d) * C[nxt];
    diff += S[d][nxt];
    //trc(nv, nn);
  }
}

// 遷移を更新 + 古い状態を保存 + スコアの更新
void update() {
  if (mode == 0) {
    dat[old].erase(begin(dat[old]) + on);
    dat[nxt].insert(begin(dat[nxt]) + nn, d);
    ans[d] = nxt;
  }
}

// 実行
void simulated_annealing(double startTemp, Timer *timer = nullptr,
                         bool is_tuning = false) {
  // タイマーの設定
  if (timer == nullptr) timer = new Timer();
  //チューニング時はタイマーをリセット
  if (is_tuning) timer->reset();

  // 焼きなまし関連のconstでない変数の初期化
  cur_time = 0;
  cur_temp = startTemp;
  score = diff = 0;

  // 初期解の構築
  init();

  // イテレーションの回数
  int iter = 0;
  while (true) {
    // 256回に1回、時間と温度を更新する
    if ((++iter & 0xFF) == 0) {
      if ((cur_time = timer->elapsed()) > end_time) break;
      cur_temp =
          end_temp + (startTemp - end_temp) * (end_time - cur_time) * inv_time;
    }

    // 次の状態を設定
    set_state(iter);

    // 差分を計算
    calc_diff();

    // 条件を満たしたときに状態を採用
    if (double(diff) > cur_temp * rnd_log.l[iter & 0xFFFF]) {
      // スコアと状態を更新
      score += diff;
      update();
    }
// デバッグ用に 65536 iteration毎に出力
#ifdef NyaanDebug
    if (!is_tuning and iter % 0xFFFFF == 0) {
      cerr << cur_time << "\t" << iter << "\t" << score << endl;
    }
#endif
  }

// 結果を出力
#ifdef NyaanDebug
  cerr << iter << "\t" << score << endl;
#endif
}

// 実行用
void run(double temp) {
  Timer timer;
  input();
  simulated_annealing(temp, &timer);
  output();
  return;
}

// パラメータ調整
// スコアの管理はオーバーフローに備えてdoubleを使っている
pair<double, double> tuningTemp(const vector<string> &filenames,
                                double left_log = 0, double right_log = 16,
                                double range = 1.0,
                                map<double, double> *mp = nullptr) {
  constexpr int range_size = 8;

  cerr << "range : " << exp2(left_log) << " ~ " << exp2(right_log) << endl;

  // 値の範囲がある程度絞られたらreturn
  if (right_log - left_log <= range) {
    assert(mp != nullptr);
    cerr << "tuning finished." << endl;
    cerr << "left_log_2 : " << left_log << endl;
    cerr << "right_log_2 : " << right_log << endl;
    for (int i = 0; i <= range_size; i += 2) {
      double cur_log = left_log + (right_log - left_log) * i / range_size;
      cerr << "temp : " << exp2(cur_log) << " \t, val = " << (*mp)[cur_log]
           << endl;
    }
    return pair<double, double>({exp2(left_log), exp2(right_log)});
  }

  // mapの初期化
  if (mp == nullptr) mp = new map<double, double>;
  // timerの初期化
  Timer *timer = new Timer();

  // 雑に対数軸で等分して調べる
  vector<double> score1(range_size + 1, 0);
  for (int i = 0; i <= range_size; i++) {
    double cur_log = left_log + (right_log - left_log) * i / range_size;
    if ((*mp).find(cur_log) != (*mp).end()) {
      score1[i] = (*mp)[cur_log];
    } else {
      double t = exp2(cur_log);
      for (auto &filename : filenames) {
        cerr << filename << "\t" << t << "\t";
        ifstream is(filename);
        cin.rdbuf(is.rdbuf());
        input();
        simulated_annealing(t, timer, true);
        score1[i] += score;
      }
      (*mp)[cur_log] = score1[i];
    }
  }

  // 結果を貼る
  for (int i = 0; i <= range_size; i++) {
    double cur_log = left_log + (right_log - left_log) * i / range_size;
    cerr << "log : " << cur_log;
    cerr << "\t temp : " << exp2(cur_log);
    cerr << "\t score : " << score1[i] << endl; 
  }

  // 範囲のスコアを雑に重みづけして計算
  int half_range = range_size / 2;
  vector<double> score2(half_range + 1, 0);
  for (int i = 0; i <= half_range; i++) {
    for (int j = 0; j <= half_range; j++) {
      double weight = pow(2, min(j, half_range - j));
      score2[i] += weight * score1[i + j];
    }
  }

  // 最大である区間を次の探索先として決定
  int mx = max_element(begin(score2), end(score2)) - begin(score2);
  double left2 = left_log + (right_log - left_log) * mx / range_size;
  double right2 =
      left_log + (right_log - left_log) * (mx + half_range) / range_size;

  // timerの開放
  delete timer;

  // 必要ならば次の範囲を呼び出す
  // return tuningTemp(filenames, left2, right2, range, mp);
}

}  // namespace Simulated_Annealing
namespace SA = Simulated_Annealing;

void solve() { 
  /*
  SA::tuningTemp({"input0", "input1", "input2", "input3", "input4", "input5",
                  "input6", "input7", "input8", "input9"}
                 ,10,11,0.3);
  */
  SA::run(exp2(10.625));
}

Measured memory_bytes: 4236