#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;

// AtCoder
const i64 CYCLES_PER_SEC = 3000000000;

struct Timer {
	i64 start;
	Timer(){reset();}
	void reset(){start=getCycle();}
	inline double get(){return (double)(getCycle()-start)/CYCLES_PER_SEC;}
	inline i64 getCycle(){
		u32 low,high;
		__asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
		return ((i64)low)|((i64)high<<32);
	}
};

Timer timer;

uint32_t xor128(){
  static uint32_t x = 123456789;
  static uint32_t y = 362436069;
  static uint32_t z = 521288629;
  static uint32_t w = 88675123;
  uint32_t t = x ^ (x << 11);
  x = y; y = z; z = w;
  return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

//INSERT ABOVE HERE
const int A = 26;
const int MAX_D = 365;
int cs[A+1];
int s[MAX_D+1][A+1];
int r[A+1][MAX_D+1];
int ts[MAX_D+1];
int ls[A+1];

using BS = bitset<64 * 6>;
BS vs[A+1];

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int D;
  cin>>D;

  for(int j=1;j<=A;j++) cin>>cs[j];

  for(int i=1;i<=D;i++)
    for(int j=1;j<=A;j++)
      cin>>s[i][j],r[j][i]=s[i][j];

  {
    memset(ls,0,sizeof(ls));
    for(int i=1;i<=D;i++){
      vector<int> ss(A+1,0);
      for(int j=1;j<=A;j++)
        ss[j]=s[i][j]+cs[j]*(i-ls[j]);
      ts[i]=max_element(ss.begin()+1,ss.end())-ss.begin();

      ls[ts[i]]=i;
      vs[ts[i]].set(i);
    }
    for(int j=1;j<=A;j++) vs[j].set(D+1);
  }

  auto calcScore=[&]()->int{
    int res=0;
    memset(ls,0,sizeof(ls));
    for(int i=1;i<=D;i++){
      res+=s[i][ts[i]];
      ls[ts[i]]=i;
      for(int j=1;j<=A;j++)
        res-=cs[j]*(i-ls[j]);
    }
    return res;
  };

  auto calcDiff=[&](int p)->int{
    int res=0;
    int cp=cs[p],lp=0;
    for(int i=vs[p]._Find_first();i<(int)vs[p].size();i=vs[p]._Find_next(i)){
      res-=cp*(i-lp)*(i-lp-1)/2;
      res+=r[p][i],lp=i;
    }
    return res;
  };

  int tmpScore=calcScore();

  double start_temp = 3000, end_temp = 300;

  const double LIM = 1.95;
  int iter_num = 0;
  while(timer.get()<LIM){
    iter_num++;
    if(iter_num%2==0){
      int d=xor128()%D+1;
      int q=xor128()%A+1;

      int p=ts[d];
      if(p==q) q=(q+1)%A+1;

      int nxtScore=tmpScore;
      nxtScore-=calcDiff(p)+calcDiff(q);
      vs[ts[d]].flip(d);
      ts[d]=q;
      vs[ts[d]].flip(d);
      nxtScore+=calcDiff(p)+calcDiff(q);
      // assert(nxtScore==calcScore());

      double temp = start_temp + (end_temp - start_temp) * timer.get() / LIM;
      double prob = std::exp((nxtScore-tmpScore)/temp);

      const int INF = 1<<30;
      if(prob > (xor128()%INF)/(double)INF){
        tmpScore=nxtScore;
      }else{
        vs[ts[d]].flip(d);
        ts[d]=p;
        vs[ts[d]].flip(d);
      }
    }

    if(iter_num%2==1){
      int x=xor128()%D+1;
      int y=xor128()%D+1;

      int p=ts[x];
      int q=ts[y];
      if(p==q) continue;

      int nxtScore=tmpScore;
      nxtScore-=calcDiff(p)+calcDiff(q);
      vs[ts[x]].flip(x);
      vs[ts[y]].flip(y);
      swap(ts[x],ts[y]);
      vs[ts[x]].flip(x);
      vs[ts[y]].flip(y);
      nxtScore+=calcDiff(p)+calcDiff(q);
      // assert(nxtScore==calcScore());

      double temp = start_temp + (end_temp - start_temp) * timer.get() / LIM;
      double prob = std::exp((nxtScore-tmpScore)/temp);

      const int INF = 1<<30;
      if(prob > (xor128()%INF)/(double)INF){
        tmpScore=nxtScore;
      }else{
        vs[ts[x]].flip(x);
        vs[ts[y]].flip(y);
        swap(ts[x],ts[y]);
        vs[ts[x]].flip(x);
        vs[ts[y]].flip(y);
      }
    }
  }

  cerr<<iter_num<<endl;
  cerr<<tmpScore<<":"<<calcScore()<<endl;
  for(int i=1;i<=D;i++) cout<<ts[i]<<newl;
  return 0;
}


Measured memory_bytes: 4328