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

  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;
      
      if(not func(d)){
        break;
      }
    }
  }

}



namespace solver{

  template <typename Random>
  bool roulette(double x, Random &rand){
    constexpr int N = 10000;
    if(x >= 1.0) return true;
    if(x <= 0.0) return false;

    return (int)(rand() % (N + 1)) < (int)(x * N);
  }





  
  using namespace utils;
  
  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;
    }
  };

  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);



    
    

    std::pair<int, std::vector<int>> opt(score.score, t);

    double T = 100000;

    while(T > 0){
      if(rand() % 2){
        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(opt.first < res){
          opt.first = res;
          opt.second = t;
        }
      
        if(res < prev){
          double pr = std::exp((res-prev) / T);
          if(not roulette(pr, rand)){
            t[d] = old;
            score.diff(d, old);
          }
        }
      }else{
        int d1 = rand() % D + 1;
        int d2 = std::clamp((int)(d1 + rand() % 16), 1, D);

        auto prev = score.score;

        score.diff(d1, t[d2]);
        score.diff(d2, t[d1]);
        auto res = score.score;

        std::swap(t[d1], t[d2]);

        if(opt.first < res){
          opt.first = res;
          opt.second = t;
        }
        
        if(res < prev){
          double pr = std::exp((res-prev) / T);
          if(not roulette(pr, rand)){
            score.diff(d1, t[d2]);
            score.diff(d2, t[d1]);
            
            std::swap(t[d1], t[d2]);
          }
        }
      }

      dump(score.score);

      T--;
    }

    dump(opt);

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

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


Measured memory_bytes: 4396