#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <random>
#include <chrono>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

template<typename T> using maximum_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;
template<typename T> using minimum_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
std::istream& operator>>(std::istream &is, std::vector<T> &v)
{
  for (typename std::vector<T>::size_type i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}

using namespace std;

const uint64_t TIMEOUT_MS = 2000;
const uint64_t TIMEOUT_MS_ESP = 50;
const uint64_t M = 26;

int main()
{
  chrono::system_clock::time_point start = chrono::system_clock::now();

  random_device device;
  default_random_engine engine(device());

  uint64_t D;
  cin >> D;

  vector<int64_t> c(M);
  cin >> c;

  vector<vector<int64_t>> s(D, vector<int64_t>(M));
  N_TIMES(d, D) { cin >> s[d]; }

  vector<int64_t> dissatisfied(M, 0);
  vector<set<uint64_t, greater<uint64_t>>> last(M);
  N_TIMES(m, M) { last[m].insert(0); }

  // B問題を踏まえて貪欲法で解く。
  // 各d日目で最もスコアが最大となるような選択を行う。
  auto greedy = [&] () {
    int64_t S = 0;
    vector<uint64_t> t(D, 0);

    N_TIMES(d, D) {
      int64_t max_T = -1e+16, max_t = -1;
      N_TIMES(t, M) {
        int64_t T = s[d][t];
        N_TIMES(m, M) {
          if (m == t) { continue; }
          T -= c[m] * ((d + 1) - *last[m].lower_bound(d + 1));
        }

        if (max_T < T) {
          max_T = T;
          max_t = t;
        }
      }

      t[d] = max_t;

      last[max_t].insert(d + 1);
      S += max_T;
    }

    return make_pair(S, t);
  };

  pair<int64_t, vector<uint64_t>> ret = greedy();
  int64_t S = ret.first;
  vector<uint64_t> t = ret.second;

  // C問題を踏まえて局所探索法で解く。
  // dとqをランダムに選び，改善されるなら更新する。
  auto query = [&](uint64_t d, uint64_t q) {
    int64_t T = 0;
    int64_t old_t_d = t[d], old_dissatisfied_t_d = dissatisfied[t[d]], old_dissatisfied_q = dissatisfied[q];

    T -= s[d][t[d]];
    last[t[d]].erase(d + 1);

    T += dissatisfied[t[d]];
    dissatisfied[t[d]] = 0;
    N_TIMES(i, D) {
      dissatisfied[t[d]] += c[t[d]] * ((i + 1) - *last[t[d]].lower_bound(i + 1));
    }
    T -= dissatisfied[t[d]];

    t[d] = q;

    T += s[d][q];
    last[q].insert(d + 1);
    
    T += dissatisfied[q];
    dissatisfied[q] = 0;
    N_TIMES(i, D) {
      dissatisfied[q] += c[q] * ((i + 1) - *last[q].lower_bound(i + 1));
    }
    T -= dissatisfied[q];

    if (T <= 0) { // rollback
      t[d] = old_t_d;
      dissatisfied[t[d]] = old_dissatisfied_t_d;
      dissatisfied[q] = old_dissatisfied_q;
      last[t[d]].insert(d + 1);
      last[q].erase(d + 1);
    } else {
      S += T;
    }

    return S;
  };

  uniform_int_distribution<> dist_d(0, D - 1);
  uniform_int_distribution<> dist_q(0, M - 1);
  while (true) {
    uint64_t time_duration = static_cast<uint64_t>(
      chrono::duration_cast<std::chrono::milliseconds>(
        chrono::system_clock::now() - start
      ).count()
    );
    if (time_duration >= (TIMEOUT_MS - TIMEOUT_MS_ESP)) { break; }

    uint64_t d = dist_d(engine), q = dist_q(engine);
    query(d, q);
  }

  N_TIMES(d, D) { cout << (t[d] + 1) << endl; }

  return 0;
}

Measured memory_bytes: 3732