#include <bits/stdc++.h>

/**
 * @docs input_vector.md
 */
template <typename T>
std::vector<T> input_vector(int N){
  std::vector<T> ret(N);
  for(int i = 0; i < N; ++i) std::cin >> ret[i];
  return ret;
}

template <typename T>
std::vector<std::vector<T>> input_vector(int N, int M){
  std::vector<std::vector<T>> ret(N);
  for(int i = 0; i < N; ++i) ret[i] = input_vector<T>(M);
  return ret;
}


#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...)
#endif

namespace solver{

  template <typename T, int I = 1>
  auto to_0_indexed(T a){
    for(auto &x : a) x -= I;
    return a;
  }

  template <typename T>
  auto padding(const std::vector<T> &a, size_t d, T value){
    std::vector<T> ret(d, value);
    ret.insert(ret.end(), a.begin(), a.end());
    return ret;
  }


  
  constexpr int CONTEST = 26;
  
  struct Scoring{
    const int D;
    const std::vector<int> c;
    const std::vector<std::vector<int>> s;
    std::vector<int> t;
    std::vector<std::vector<int>> last;
    int score;

    Scoring(int D, std::vector<int> c, std::vector<std::vector<int>> s):
      D(D), c(c), s(s){}
    
    int calc(std::vector<int> t_){
      t = t_;
      
      int ret = 0;
      last = std::vector(D + 1, std::vector<int>(CONTEST, 0));
      
      for(int i = 1; i <= D; ++i){
        ret += s[i][t[i]];
        for(int j = 0; j < CONTEST; ++j){
          last[i][j] = last[i-1][j];
        }
        last[i][t[i]] = i;

        for(int j = 0; j < CONTEST; ++j){
          ret -= c[j] * (i - last[i][j]);
        }

      }
 
      return score = ret;
    }
    
    int diff(int d, int q){
      const int p = t[d];

      if(p == q) return score;

      score -= s[d][p];
      score += s[d][q];
      
      {
        auto yesterday_last = last[d-1][p];
        auto today_last = last[d][p];
        for(int i = d; i <= D; ++i){
          if(last[i][p] != today_last) break;
          score += c[p] * (i - today_last);
          score -= c[p] * (i - yesterday_last);
          last[i][p] = yesterday_last;
        }
      }

      {
        auto yesterday_last = last[d-1][q];
        auto today_last = d;
        for(int i = d; i <= D; ++i){
          if(last[i][q] != yesterday_last) break;
          score += c[q] * (i - yesterday_last);
          score -= c[q] * (i - today_last);
          last[i][q] = today_last;
        }
      }
      
      t[d] = q;

      return score;
    }
  };


  template <typename Func>
  void loop(int duration, Func func){
    using namespace std::chrono;
    auto s = system_clock::now();

    while(true){
      auto t = system_clock::now();
      auto d = duration_cast<milliseconds>(t - s).count();
      if(d >= duration) break;
      
      func(d);
    }
  }

  

  
  void solve(){
    std::mt19937 rand(time(0));
    
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    
    int D; std::cin >> D;
    auto c = input_vector<int>(CONTEST);
    auto s = padding(input_vector<int>(D, CONTEST), 1, std::vector<int>(CONTEST));

    std::vector<int> t(D + 1);
    for(int i = 1; i <= D; ++i) t[i] = rand() % CONTEST;

    Scoring score(D, c, s);
    score.calc(t);

    dump(score.score);


    loop(1800,
         [&](int){
           int d = rand() % D + 1;
           int q = rand() % CONTEST;

           auto old = t[d];

           t[d] = q;
           auto prev = score.score;
           auto res = score.diff(d, q);
      
           if(res < prev){
             t[d] = old;
             score.diff(d, old);
           }

           dump(score.score);
         }
    );

    for(int i = 1; i <= D; ++i){
      std::cout << t[i] + 1 << "\n";
    }
  }
}

int main(){
  solver::solve();
  return 0;
}


Measured memory_bytes: 3792