#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  auto start=std::chrono::system_clock::now();

  std::random_device rnd;
  std::mt19937 mt(rnd());

  ll d;
  std::cin>>d;

  std::uniform_int_distribution<> day_rand(0,d-1),type_rand(0,25);
  std::uniform_real_distribution<> prob_rnd(0,1);

  double TIME_LIMIT=1900;

  constexpr ll TYPE=26;
  std::array<ll,TYPE> c;
  rep(i,0,TYPE)std::cin>>c[i];

  std::vector<std::array<ll,TYPE>> s(d);
  rep(i,0,d){
    rep(j,0,TYPE)std::cin>>s[i][j];
  }

  ll ans=0;

  std::vector<ll> contest(d);

  std::array<std::set<ll>,TYPE> sched;
  rep(i,0,TYPE)sched[i].emplace(-1);

  {
   
    std::array<ll,TYPE> last;
    last.fill(-1);

    rep(i,0,d){
      contest[i]=i%TYPE;
      ans+=s[i][contest[i]];
      last[contest[i]]=i;
      sched[contest[i]].emplace(i);
      rep(j,0,TYPE)ans-=c[j]*(i-last[j]);
    }

  }

  rep(i,0,TYPE)sched[i].emplace(d);

  auto calc=[&](ll day,ll q)->ll{
    ll ret=0;
    ll prev=contest[day];
    ret-=s[day][prev];
    ret+=s[day][q];

    ll val=day-*(--sched[prev].lower_bound(day));
    ll len=*sched[prev].upper_bound(day) - day;
    ret-=c[prev]*val*len;

    val=day-*(--sched[q].lower_bound(day));
    len=*sched[q].upper_bound(day) - day;
    ret+=c[q]*val*len;

    return ret;
  };

  auto update=[&](ll day,ll q){
    ll prev=contest[day];
    ans-=s[day][prev];
    ans+=s[day][q];

    ll val=day-*(--sched[prev].lower_bound(day));
    ll len=*sched[prev].upper_bound(day) - day;
    ans-=c[prev]*val*len;
    sched[prev].erase(day);


    sched[q].insert(day);
    val=day-*(--sched[q].lower_bound(day));
    len=*sched[q].upper_bound(day) - day;
    ans+=c[q]*val*len;

    contest[day]=q;
  };

  double start_temp=100000,end_temp=0;

  while(true){
    auto lap=std::chrono::system_clock::now();
    double time=std::chrono::duration_cast<std::chrono::milliseconds>(lap-start).count();
    if(time > TIME_LIMIT)break;

    ll new_day=day_rand(mt);
    ll new_type=type_rand(mt);

    if(contest[new_day]==new_type)continue;

    double dif=calc(new_day,new_type);

    double temp=start_temp+(end_temp-start_temp) * time/TIME_LIMIT;

    double prob=std::exp(dif/temp);

    if(prob > prob_rnd(mt)){
      update(new_day,new_type);
    }
  }

  rep(i,0,d){
    std::cout<<contest[i]+1<<"\n";
  }

  return 0;
}

Measured memory_bytes: 4404