#include <bits/stdc++.h>
using namespace std;

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return true; } return false;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return true; } return false;
}

int32 d;
int32 c[26];
int32 s[365][26];

int32 last[365][26];
int32 S;
int32 score(vector<int32> &t, int32 e = d){
  REP(i,26)last[0][i] = -1;
  S = 0;
  REP(i,e){
    S += s[i][t[i]];
    if(i != 0){
      REP(j,26){
        last[i][j] = last[i-1][j];
      }
    }
    last[i][t[i]] = i;
    REP(j,26)S -= c[j] * (i - last[i][j]);
    // ANS(res);
  }
  return S;
}

int32 chquery(vector<int32> &t, int32 di, int32 nt){
  S -= s[di][t[di]];
  int32 pre = last[di][t[di]];
  if(di == 0){
    last[di][t[di]] = -1;
  }else{
    last[di][t[di]] = last[di-1][t[di]];
  }
  S -= c[t[di]] * (pre - last[di][t[di]]);
  FOR(i,di+1,d){
    if(t[i] == t[di])break;
    S -= c[t[di]] * (last[i][t[di]] - last[i-1][t[di]]);
    last[i][t[di]] = last[i-1][t[di]];
  }

  t[di] = nt;

  S += s[di][t[di]];
  pre = last[di][t[di]];
  last[di][t[di]] = di;
  S += c[t[di]] * (di - pre);
  FOR(i,di+1,d){
    if(t[i] == t[di])break;
    S += c[t[di]] * (di - pre);
    last[i][t[di]] = di;
  }

  return S;
}

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

  // input
  cin >> d;
  REP(i,26)cin >> c[i];
  REP(i,d)REP(j,26)cin >> s[i][j];

  // scoring
  // vector<int32> t(d);
  // REP(i,d)cin >> t[i];
  // REP(i,d)t[i]--;
  // score(t);
  // REP(i,d)ANS(score(t,i+1));

  // greedy
  vector<int32> t(d,-1);
  REP(i,d){
    int32 mx=-inf,mxj=-1;
    REP(j,26){
      t[i] = j;
      if(chmax(mx,score(t,i+1))){
        mxj = j;
      }
    }
    t[i] = mxj;
  }
  score(t);
  // REP(i,d)ANS(t[i]+1);
  // ANS(S);

  // incremental scoring
  // int32 m;
  // cin >> m;
  // REP(_,m){
  //   int32 di,q;
  //   cin >> di >> q;
  //   di--;q--;
  //   ANS(chquery(t,di,q));
  // }

  // local search
  vector<vector<pii>> s_sorted(d);
  REP(i,d)REP(j,26)s_sorted[i].emplace_back(s[i][j],j);
  REP(i,d)sort(s_sorted[i].rbegin(),s_sorted[i].rend());
  int32 rep = 4000000;
  std::mt19937 mt{ std::random_device{}() };
  std::uniform_int_distribution<int32> drand(0, d-1);
  std::mt19937 mt2{ std::random_device{}() };
  std::uniform_int_distribution<int32> qrand(0, 7);
  REP(_,rep){
    int32 di = drand(mt);
    int32 q = s_sorted[di][qrand(mt2)].se;
    // cout << di << " " << q << endl;
    int32 pre = t[di];
    int32 preS = S;
    if(pre == q)continue;
    chquery(t,di,q);
    if(preS > S){
      chquery(t,di,pre);
    }
    // ANS(S);
  }
  // ANS(S);
  REP(i,d)ANS(t[i]+1);

  return 0;
}

Measured memory_bytes: 3940