#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}  
int D;
vector<int> c(26);
vector<vector<int>> s;
struct State {
  int ans = 0;
  vector<int> t;
  vector<int> sscore;
  vector<vector<int>> cscore;
};
void score(State &st, set<int> idx, int firstday) {
  vector<int> last(26);
  REP(i, D) {
    last[st.t[i]] = i + 1;
    if(i < firstday) continue;
    st.ans += s[i][st.t[i]] - st.sscore[i];
    st.sscore[i] = s[i][st.t[i]];
    
    bool flg = false;
    for(int j : idx) {
      if(st.cscore[i][j] != c[j] * (i + 1 - last[j])) {
        st.ans -= (c[j] * (i + 1 - last[j]) - st.cscore[i][j]);
        st.cscore[i][j] = c[j] * (i + 1 - last[j]);
        flg = true;
      }
    }
    if(!flg) break;
  }
}
double TIME_LIMIT = 1970;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> D;
  REP(i, 26) cin >> c[i];
  s = vector<vector<int>>(D, vector<int>(26));
  REP(i, D) REP(j, 26) cin >> s[i][j];

  State st;
  vector<int> t(D);
  REP(i, D) {
    int idx = 0;
    int max = -1e9;
    vector<int> last(26);
    REP(j, 26) {
      int score = s[i][j] + c[i] * (i + 1 - last[j]);
      if(score > max) {
        max = score;
        idx = j;
      }
    }
    t[i] = idx;
    last[idx] = i + 1;
  }
  st.t = t;
  vector<int> sscore(D);
  st.sscore = sscore;
  vector<vector<int>> cscore(D, vector<int>(26));
  st.cscore = cscore;
  set<int> idxset;
  REP(i, 26) idxset.insert(i);
  score(st, idxset, 0);
  
  clock_t start_time = clock();
  int loop = 0;
  double start_temp = 4000, end_temp = 1;
  double time = 0;
  while(true) {
    loop++;
    if(loop%1000 == 0) {
      clock_t now_time = clock();
      time = static_cast<double>(now_time - start_time) / CLOCKS_PER_SEC * 1000.0;
      if(time > TIME_LIMIT) break;
    }
    int mode = rand() % (100);
    int tmpidx, tmptype;
    idxset.clear();
    int lastans = st.ans;
    if(mode <= 60) {
      int idx = rand() % D;
      int type = rand() % 26;
      tmpidx = idx;
      tmptype = st.t[idx];
      st.t[idx] = type;
      idxset.insert(type);
      idxset.insert(tmptype);
    } else {
      int idx = rand() % (D-1);
      swap(st.t[idx], st.t[idx+1]);
      tmpidx = idx;
      idxset.insert(st.t[idx]);
      idxset.insert(st.t[idx+1]);
    }
    score(st, idxset, tmpidx);
    double temp = start_temp + (end_temp - start_temp) * time / TIME_LIMIT;
    double prob = exp((st.ans-lastans)/temp);
    if(st.ans > lastans || prob > (rand()%INF)/(double)INF) {
      ;
    } else {
      if(mode <= 60) {
        st.t[tmpidx] = tmptype;
      } else {
        swap(st.t[tmpidx], st.t[tmpidx+1]);
      }
      score(st, idxset, tmpidx);
    }
    //cout << st.ans << "\n";
    //if(next < now) cout << prob << "\n";
  }
  REP(i, D) cout << (st.t[i]+1) << "\n";
  //cout << st.ans << "\n";
  //cout << loop << "\n";
}

Measured memory_bytes: 4436