#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];

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

  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 q)->int{
    int res=0;
    int cp=cs[p],lp=0;
    int cq=cs[q],lq=0;

    for(int i=1;i<=D;i++){
      if(ts[i]==p) res+=r[p][i],lp=i;
      if(ts[i]==q) res+=r[q][i],lq=i;
      res-=cp*(i-lp);
      res-=cq*(i-lq);
    }
    return res;
  };

  int tmpScore=calcScore();

  double start_temp = 1000, end_temp = 100;

  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,q);
      ts[d]=q;
      nxtScore+=calcDiff(p,q);
      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{
        ts[d]=p;
      }
    }

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

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

      int nxtScore=tmpScore;
      nxtScore-=calcDiff(p,q);
      swap(ts[x],ts[y]);
      nxtScore+=calcDiff(p,q);
      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{
        swap(ts[x],ts[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: 4340