/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

// initial: random
// annealing: no
// 77477817

// initial: max s
// annealing: no
// 93907681

// initial: max s
// annealing:         if (diff >= 0 || (rng()%10 < 1 && diff > -1000)) {
// 98343220

// initial: max s
// annealing:         if (diff >= 0 || (rng()%10 < 1 && diff > -1000)) {
// choose bigger c[i]
// 98745730

// annealing: if (diff >= 0 || (rng()%10 < 1 && clock() - start < 1.8 * CLOCKS_PER_SEC)) {
// initial: max s
// choose bigger c[i]
// time 1.95
// 80264196

// initial: max s
// annealing:         if (diff >= 0 || (rng()%10 < 1 && diff > -1000)) {
// choose bigger c[i]
// time 1.95
// 98809880

// initial: max s
// annealing: no
// choose: random day
// choose: max q
// time 1.95
// 96666647

// initial: max s
// annealing:
//         if (rng()%10 < 1 && vec[0].first < vec[1].first + 1000) {
// choose: random day
// choose: max q
// time 1.95
// 99135201

// initial: max s
// annealing:
//         if (rng()%10 < 1 && vec[0].first < vec[1].first + 2000) {
// choose: random day
// choose: max q
// time 1.95
// 103477880

// initial: max s
// annealing:
//         if (rng()%10 < 1 && vec[0].first < vec[1].first + 10000) {
// choose: random day
// choose: max q
// time 1.95
// 106090512

// initial: max s
// annealing:
//         if (rng()%10 < 1 && vec[0].first < vec[1].first + 100000) {
// choose: random day
// choose: max q
// time 1.95
// very low

// initial: max s
// annealing:
//         if (rng()%10 < 1 && vec[0].first < vec[1].first + 5000) {
// choose: random day
// choose: max q
// time 1.95
// 114920579

class AAtCoderContestScheduling {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;

      int d; cin >> d;
      vector<int> c(26);
      vector<int> prob;
      rep(i, 26) {
        cin >> c[i];
        rep(j, c[i]) {
          prob.push_back(i);
        }
      }
      int ps = prob.size();
      vector<vector<ll>> s(d, vector<ll>(26));
      rep(i, d) rep(j, 26) {
        cin >> s[i][j];
      }
      ll ret = 0;
      set<int> last[26];
      rep(i, 26) {
        last[i].insert(0);
        last[i].insert(d+1);
      }
      vector<ll> last2(26);
      vector<int> contests(d);
      rep(i, d) {
        ll ma = -1;
        int t = -1;
        rep(j, 26) {
          if (chmax(ma, s[i][j])) t = j;
        }

        contests[i] = t;
        ret += s[i][t];
        last[t].insert(i+1);
        last2[t] = i+1;
        rep(j, 26) {
          ret -= c[j]*(i+1-last2[j]);
        }
      }

      auto start = clock();

      while(clock() - start < 1.95 * CLOCKS_PER_SEC) {
        int day = rng()%d;

        int before = contests[day];

        ll diff = 0;
        diff -= s[day][before];

        day++;
        last[before].erase(day);
        auto it = last[before].upper_bound(day);
        int right = (*it);
        it--;
        int left = (*it);
        diff -= c[before]*(day-left)*(right-day);

        vector<P> vec;
        rep(j, 26) {
          int diff2 = 0;
          int q = j;
          diff2 += s[day-1][q];
          it = last[q].upper_bound(day);
          right = (*it);
          it--;
          left = (*it);
          diff2 += c[q]*(day-left)*(right-day);
          vec.emplace_back(diff2, q);
        }
        sort(vec.rbegin(), vec.rend());

        auto pa = vec[0];
        if (rng()%10 < 1 && vec[0].first < vec[1].first + 6500) {
          pa = vec[1];
        }

        last[pa.second].insert(day);
        contests[day-1] = pa.second;
        ret += diff + pa.first;
      }

      rep(i, d) {
        cout << contests[i]+1 << '\n';
      }
      debug(ret);
    }
};

signed main() {
  AAtCoderContestScheduling solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 3784