#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <shared_mutex>
#include <boost/format.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>

#ifdef DEBUG
#include "libs/debug.cpp"
#define DEBUG 1
#else
#define DEBUG 0
#endif

#define rep(i, n) repr((i), 0, (n))
#define repr(i, a, t) reps((i), (a), (t), 1)
#define reps(i, a, t, s) for (long long (i) = (a); (i) < (long long)(t); (i) += (s))
#define rrep(i, n) rrepr((i), (n), 0)
#define rrepr(i, a, t) rreps((i), (a), (t), 1)
#define rreps(i, a, t, s) for (long long (i) = (a) - 1; (i) >= (long long)(t); (i) -= (s))
#define each(v, c) for (auto &&(v) : (c))
#define all(c) (c).begin(), (c).end()

using namespace std;

// コンテナのメンバ関数を使わないと O(N)
template<typename T>
typename set<T>::iterator lower_bound(typename set<T>::iterator l, typename set<T>::iterator r, const T &v);
template<typename T>
typename set<T>::iterator upper_bound(typename set<T>::iterator l, typename set<T>::iterator r, const T &v);
template<typename S, typename T>
typename map<S, T>::iterator lower_bound(typename map<S, T>::iterator l, typename map<S, T>::iterator r, const T &v);
template<typename S, typename T>
typename map<S, T>::iterator upper_bound(typename map<S, T>::iterator l, typename map<S, T>::iterator r, const T &v);

namespace mp = boost::multiprecision;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ml = mp::cpp_int;
template<typename T>
using optional = boost::optional<T>;
const auto none = boost::none;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;

/**
 * 逆順にするなら
 * auto idx = argsort<ll>(vec, [](const auto &a, const auto &b) { return b < a; });
 * みたいにする
 * @tparam T
 * @param vec
 * @param comparator
 */
template<typename T>
vector<long long> argsort(
    const vector<T> &vec,
    const function<bool(const T &, const T &)> &comparator = [](const auto &a, const auto &b) { return a < b; }) {
  vector<pair<T, long long>> values;
  vector<long long> ret;

  for (long long i = 0; i < vec.size(); ++i) values.emplace_back(vec[i], i);
  stable_sort(values.begin(), values.end(), [&comparator](const auto &a, const auto &b) {
    return comparator(a.first, b.first);
  });
  for (const auto &item: values) ret.push_back(item.second);
  return ret;
}

unsigned int randxor() {
  static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
  unsigned int t;
  t = (x ^ (x << 11));
  x = y;
  y = z;
  z = w;
  return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

/**
 * l 以上 r 以下の整数を返す
 * @param l
 * @param r
 */
int randint(int l, int r) {
  ld rnd = (ld) randxor() / UINT_MAX;
  rnd *= (r - l + 1);
  return int(rnd) + l;
}

/**
 * pair を map のキーにできるようにハッシュ化の方法を定義
 * https://www.techiedelight.com/use-std-pair-key-std-unordered_map-cpp/
 */
struct pair_hash {
  template<class T1, class T2>
  std::size_t operator()(const std::pair<T1, T2> &pair) const {
    return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
  }
};

/**
 * 時間を計る
 * timer("<procedure name>", [&]{
 *   ...
 * });
 * @param name
 * @param fn
 */
void timer(string name, const function<void(void)> &fn) {
  auto st = chrono::system_clock::now();
  fn();
  auto now = chrono::system_clock::now();
  double t = chrono::duration_cast<chrono::milliseconds>(now - st).count();
  cerr << boost::format("[%s] %4d ms") % name % t << "\n";
}

auto calc(ll t, const set<ll> &days, const vector<vector<ll>> &S, const vector<ll> &C) -> ll {
  ll last = -1;
  ll ret = 0;
  each (d, days) {
    ll diff = d - last;
    ret += S[d][t];
    ret -= C[t] * (diff - 1) * diff / 2;
    last = d;
  }
  return ret;

}

ll move(ll d,
        ll prev_t,
        ll next_t,
        vector<ll> &T,
        vector<set<ll>> &days,
        vector<ll> &scores,
        const vector<vector<ll>> &S,
        const vector<ll> &C) {
  T[d] = next_t;
  days[prev_t].erase(d);
  days[next_t].insert(d);

  ll diff = 0;
  diff -= scores[prev_t];
  diff -= scores[next_t];
  scores[prev_t] = calc(prev_t, days[prev_t], S, C);
  scores[next_t] = calc(next_t, days[next_t], S, C);
  diff += scores[prev_t];
  diff += scores[next_t];

  return diff;
}

auto main() -> int {
  cout << fixed << setprecision(10);
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ifstream ifs;
  if (DEBUG) {
    ifs.open("/Users/yada/Downloads/tester/input.txt");
    cin.rdbuf(ifs.rdbuf());
  }

  auto start_time = chrono::system_clock::now();

  ll D;
  cin >> D;
  vector<ll> C;
  rep (i, 26) {
    ll v0;
    cin >> v0;
    C.push_back(v0);
  }
  vector<vector<ll>> S(D, vector<ll>(26));
  rep (i, D) {
    rep (j, 26) {
      cin >> S[i][j];
    }
  }
  S.emplace_back(26, 0);

  vector<ll> T;
  timer("greedy", [&] {
    vector<ll> lasts(26, -1);
    rep (d, D) {
      ll ss = 0;
      ll max_score = -INF;
      ll max_t = 0;
      rep (t, 26) {
        ll diff = d - lasts[t];
        ll score = S[d][t];
        score += C[t] * (diff - 1) * diff / 2;
        if (score > max_score) {
          max_t = t;
          max_score = score;
        }
      }
      lasts[max_t] = d;
      T.push_back(max_t);
    }
  });

  vector<set<ll>> days(26);
  rep (d, D) {
    ll t = T[d];
    days[t].insert(d);
  }
  rep (t, 26) {
    days[t].insert(D);
  }
  vector<ll> scores(26, 0);
  ll total_score = 0;
  rep (t, 26) {
    scores[t] = calc(t, days[t], S, C);
    total_score += scores[t];
  }
  auto t_candidates = argsort<ll>(C, [](const auto &a, const auto &b) { return b < a; });

  ld COOL = 0.999995;
  ld temp = 10000;
  // cout << temp * pow(COOL, 100000) << "\n";
  // return 0;

  timer("SA", [&] {
    ll cnt = 0;
    while (true) {
      rep (d, D) {
        rep (i, 26) {
          auto next_t = t_candidates[i];
          ll prev_t = T[d];
          auto diff = move(d, prev_t, next_t, T, days, scores, S, C);

          ld p = exp(diff / temp);
          ld r = (ld) randxor() / UINT_MAX;
          if (diff > 0 || (diff != 0 && r < p)) {
            total_score += diff;
            // cerr << 1 << ": " << cnt << " " << diff << " " << total_score << "\n";
          } else {
            move(d, next_t, prev_t, T, days, scores, S, C);
          }
        }

        temp *= COOL;
        cnt += 1;
      }

      rep (_, 1000) {
        ll k = randint(1, 10);
        ll d1 = randint(0, D - 1);
        ll d2 = (d1 + k) % D;
        ll t1 = T[d1];
        ll t2 = T[d2];
        if (t1 == t2) continue;

        ll diff = 0;
        diff += move(d1, t1, t2, T, days, scores, S, C);
        diff += move(d2, t2, t1, T, days, scores, S, C);
        ld p = exp(diff / temp);
        ld r = (ld) randxor() / UINT_MAX;
        if (diff > 0 || (diff != 0 && r < p)) {
          total_score += diff;
          // cerr << 2 << ": " << cnt << " " << diff << " " << k << " " << total_score << "\n";
        } else {
          move(d1, t2, t1, T, days, scores, S, C);
          move(d2, t1, t2, T, days, scores, S, C);
        }

        temp *= COOL;
        cnt += 1;
      }

      auto now = std::chrono::system_clock::now();
      double elapsed = chrono::duration_cast<chrono::milliseconds>(now - start_time).count();
      if (DEBUG) {
        if (cnt > 180000) break;
      } else {
        if (elapsed > 1850) break;
      }
    }

    cerr << "cnt: " << cnt << "\n";
    cerr << "temp: " << temp << "\n";
  });

  timer("greedy2", [&] {
    rep (k, 10) {
      rep (d, D) {
        rep (i, 26) {
          auto next_t = t_candidates[i];
          ll prev_t = T[d];
          auto diff = move(d, prev_t, next_t, T, days, scores, S, C);
          if (diff > 0) {
            total_score += diff;
            // cerr << k << " " << total_score << "\n";
          } else {
            move(d, next_t, prev_t, T, days, scores, S, C);
          }
        }
      }
    }
  });

  rep (d, D) {
    cout << (T[d] + 1) << "\n";
  }

  cerr << total_score << "\n";
}

Measured memory_bytes: 3492