#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;
}

const uint64_t TIMEOUT_MS = 2000;
const uint64_t TIMEOUT_MS_EPS = 20;

template<uint64_t TIMEOUT_MS = 2000, uint64_t TIMEOUT_MS_EPS = 50>
class TimeoutManagerBase {
private:
  std::chrono::system_clock::time_point _start;

public:
  TimeoutManagerBase() : _start(std::chrono::system_clock::now()) {}

  bool timeout(uint64_t eps_ms = TIMEOUT_MS_EPS) {
    uint64_t time_duration = static_cast<uint64_t>(
      std::chrono::duration_cast<std::chrono::milliseconds>(
        std::chrono::system_clock::now() - _start
      ).count()
    );
    return time_duration < (TIMEOUT_MS - eps_ms);
  }
};

typedef TimeoutManagerBase<TIMEOUT_MS, TIMEOUT_MS_EPS> TimeoutManager;

class UniformRandomIntegerGenerator
{
private:
  std::random_device _seed_device;
  std::default_random_engine _engine;
  std::uniform_int_distribution<uint64_t> _dist;

public:
  UniformRandomIntegerGenerator(uint64_t lower_bound = 0, uint64_t upper_bound = 100)
    : _engine(_seed_device()) 
    , _dist(std::uniform_int_distribution<uint64_t>(lower_bound, upper_bound))
  {}
  uint64_t get() { return _dist(_engine); }
};

using namespace std;

const uint64_t M = 26;

int main()
{
  TimeoutManager timeout_manager;

  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]; }

  // last[m]はタイプmのコンテストが開催された日の集合。
  // greaterでソートしたので，last[m].lower_bound(d) (1 <= d <= D)である日付dより前に開催された日がわかる。
  vector<set<uint64_t, greater<uint64_t>>> last(M);
  N_TIMES(m, M) { last[m].insert(0); }

  // 満足度の低下の合計はコンテストのタイプごとに，開催日の集合があればdに依存せず計算可能。
  vector<int64_t> dissatisfied(M, 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; } // last[t].insert(d + 1)を仮定
          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);
      N_TIMES(m, M) {
        dissatisfied[m] += c[m] * ((d + 1) - *last[m].lower_bound(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];

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

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

    t[d] = q;

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

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

    return S;
  };

  UniformRandomIntegerGenerator dist_d(0, D - 1);
  UniformRandomIntegerGenerator dist_q(0, M - 1);
  while (timeout_manager.timeout()) {
    uint64_t d = dist_d.get(), q = dist_q.get();
    query(d, q);
  }

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

  return 0;
}

Measured memory_bytes: 3744