#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <bitset>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <functional>
#include <stack>
#include <cmath>
#include <string>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

constexpr int MOD = 1000000007;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

inline int popcount(ll x) { return __builtin_popcountll(x); }
inline int div2num(ll x) { return __builtin_ctzll(x); }
inline bool bit(ll x, int b) { return (x >> b) & 1; }

template <class T> string to_string(T s);
template <class S, class T> string to_string(pair<S, T> p);
string to_string(string s) { return s; }
string to_string(const char s[]) { return to_string(string(s)); }

template <class T> string to_string(T v) {
  if (v.empty())
    return "{}";
  string ret = "{";
  for (auto x : v)
    ret += to_string(x) + ",";
  ret.back() = '}';
  return ret;
}

template <class S, class T> string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + ":" + to_string(p.second) + "}";
}
void debug() { cerr << endl; }

template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

class RandInt {
public:
  int x = 8753, y = 239017, z = 1000000123;
  int next(int d) {
    int t = x ^ (x << 11);
    x = y;
    y = z;
    z ^= (z >> 19) ^ t ^ (t >> 8);
    return z % d;
  }
} ri;

class Timer {
  static constexpr double ONE_CLOCK = 0.000000333;
  unsigned long long get_cycle() {
    unsigned int low, high;
    __asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
    return ((unsigned long long int)low) | ((unsigned long long int)high << 32);
  }

public:
  unsigned long long start_time;
  Timer() { start_time = get_cycle(); }
  int get_time() { return get_cycle() * ONE_CLOCK - start_time * ONE_CLOCK; }
} timer;

constexpr int dy[4] = {-1, 0, 1, 0}, dx[4] = {0, -1, 0, 1};

template <class StateClass>
StateClass anneal(StateClass first_state, int duration,
                  function<double(double, double, double)> accept) {
  int start_time = timer.get_time();
  int end_time = start_time + duration;
  StateClass state = first_state;
  int ct = 0;
  while (timer.get_time() < end_time) {
    double prev_score = state.score;
    state.modify();
    if (state.score < prev_score) {
      double T = (double)(end_time - timer.get_time()) / duration;
      if (ri.next(65536) / 65536.0 > accept(T, prev_score, state.score))
        state.cancel();
    }
    // ct++;
    if (0 && ct++ % 40000 == 0) {
      debug(state.score);
    }
  }
  // debug(ct);
  return state;
}

constexpr int D = 365;
int c[26];
int s[D][26];

struct State {
  int ans[D];
  int score;
  Pii last_change;
  int last_score;
  set<int> idx[26];
  State() {}
  void init() {
    int last[26] = {};
    REP(i, 26) idx[i].insert(-1);
    REP(d, D) {
      Pii best(-1, -1);
      REP(i, 26) {
        int t = s[d][i] + c[i] * (d + 1 - last[i]);
        best = max(best, Pii(t, i));
      }
      ans[d] = best.second;
      last[best.second] = d;
      idx[best.second].insert(d);
    }
  }
  void set_score() {
    score = 0;
    int last[26] = {};
    REP(d, D) {
      score += s[d][ans[d]];
      last[ans[d]] = d + 1;
      REP(i, 26) score -= c[i] * (d + 1 - last[i]);
    }
  }
  void modify() {
    int d = ri.next(D), i = ri.next(26);
    while (ans[d] == i) {
      d = ri.next(D);
      i = ri.next(26);
    }
    int j = ans[d];
    // debug(d, i, j);
    last_change = {d, j};
    last_score = score;
    score -= s[d][j];
    ans[d] = i;
    idx[j].erase(d);
    auto next_j = idx[j].lower_bound(d);
    auto prev_j = next_j;
    prev_j--;
    int j_wid = d - *prev_j;
    int j_eff = next_j == idx[j].end() ? D - d : *next_j - d;
    // debug("j", j_wid, j_eff, *prev_j, idx[j]);

    score -= c[j] * j_wid * j_eff;
    auto next_i = idx[i].lower_bound(d);
    auto prev_i = next_i;
    prev_i--;
    int i_wid = d - *prev_i;
    int i_eff = next_i == idx[i].end() ? D - d : *next_i - d;
    // debug("i", i_wid, i_eff, *prev_i, idx[i]);

    score += c[i] * i_wid * i_eff;
    idx[i].insert(d);
    score += s[d][i];
  }
  void cancel() {
    idx[ans[last_change.first]].erase(last_change.first);
    idx[last_change.second].insert(last_change.first);
    ans[last_change.first] = last_change.second;
    score = last_score;
  }
  void copy_answer(State &state) {
    score = state.score;
    REP(d, D) ans[d] = state.ans[d];
  }
  void print_answer() { REP(d, D) cout << ans[d] + 1 << endl; }
};

int main() {
  int _;
  cin >> _;
  REP(i, 26) cin >> c[i];
  REP(d, D) REP(i, 26) cin >> s[d][i];
  State state;
  state.init();
  state.set_score();
  state = anneal(state, 1900, [](double T, double prev, double now) {
    double diff = now - prev;
    return exp(diff / 2000 / T);
  });
  debug(state.score);
  state.print_answer();
  return 0;
}


Measured memory_bytes: 4500