#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags

#ifdef Rahul
# include "RAHUL.h"
#else
# include <bits/stdc++.h>
  using namespace std;
# define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

auto seed = chrono::steady_clock::now().time_since_epoch().count();
//~ auto seed = 58;
mt19937 rng(seed);
inline int randint(int a, int b) {
  return uniform_int_distribution<int>(a, b)(rng);
}
inline auto gettime() {
  return std::chrono::high_resolution_clock::now();
}
inline int duration(auto d) {
  // time from d till now (in milliseconds)
  return (int) std::chrono::duration_cast<std::chrono::milliseconds>(gettime() - d).count();
}

int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  auto Start = gettime();
  const int N = 365, K = 26;
  vector<int> c(K);
  vector<vector<int>> s(N, vector<int>(K));
  cin >> c[0];
  for (int &x : c) cin >> x;
  for (auto &v : s) for (int &x : v) cin >> x;
  vector<int> best(N);
  vector<int> ans(N);
  int bs = -MOD;
  for (int f = 0; f < 26; ++f) {
    for (int f2 = 0; f2 < 26; ++f2) {
      for (int f3 = 0; f3 < 26; ++f3) {
        vector<int> last(K, -1);
        int score = (int) 1e6;
        for (int i = 0; i < N; ++i) {
          int dec = 0;
          for (int j = 0; j < K; ++j) {
            dec += c[j] * (i - last[j]);
          }
          int mx = -MOD, t = -1;
          if (i == 0) {
            t = f;
          } else if (i == 1) {
            t = f2;
          } else if (i == 2) {
            t = f3;
          } else {
            for (int j = 0; j < K; ++j) {
              if (uax(mx, s[i][j] - dec + c[j] * (i - last[j]))) t = j;
            }
          }
          score += s[i][t] - dec + c[t] * (i - last[t]);
          last[t] = i;
          ans[i] = t;
        }
        if (uax(bs, score)) swap(ans, best);
      }
    }
  }
  int old = bs;
  ans = best;
  int cs = bs;
  double temp = 1;
  double delta = 0.99995;
  auto r1 = uniform_int_distribution<int>(0, N - 1);
  auto r2 = uniform_int_distribution<int>(0, K - 1);
  auto r3 = uniform_real_distribution<double>(0.0, 1.0);
  int itr = 0;
  error(duration(Start));
  //~ while (duration(Start) < 600) {
  //~ while (itr < 5000) {
  while (duration(Start) < 1900) {
    ++itr;
    int x = r1(rng);
    int y = r2(rng);
    int oy = ans[x];
    ans[x] = y;
    vector<int> last(K, -1);
    int score = (int) 1e6;
    for (int i = 0; i < N; ++i) {
      int dec = 0;
      for (int j = 0; j < K; ++j) {
        dec += c[j] * (i - last[j]);
      }
      score += s[i][ans[i]] - dec + c[ans[i]] * (i - last[ans[i]]);
      last[ans[i]] = i;
    }
    if (uax(bs, score)) {
      best = ans;
      error(itr);
    }
    if (exp((score - cs) / temp) > r3(rng)) {
      swap(cs, score);
    } else {
      ans[x] = oy;
    }
    temp *= delta;
  }
  error(temp, bs, itr, bs-old);
  for (int &x : best) cout << 1 + x << '\n';
}


Measured memory_bytes: 4348