#include <iostream>
#include <algorithm>

#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>

#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>

#include<memory>

#include <climits>


using namespace std;
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> pli;
typedef pair<double,int> pdi;
typedef pair<long double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

template <class T>
using MINPQ = std::priority_queue<T, vector<T>, greater<T>>; //MINPQ<pii> pq;
template <class T>
using MAXPQ = std::priority_queue<T>;


const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll INFLL = 1LL<<62;
const double EPS = 1e-12;
const ll mod = 1000000000 + 7;
//const ll mod = 998244353;
const int dx4[4] = {0, 0, -1, 1};
const int dy4[4] = {-1, 1, 0, 0};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const long double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false
#define stand(B, i) (((B>>i) & 1) == 1) ? true : false //Bのi番目のbitが1ならtrue, 0ならfalse

//debug
#define DEBUG

#define DUMPOUT cerr

#ifdef DEBUG
#define dump(...) DUMPOUT<<#__VA_ARGS__<<" :["<<__FUNCTION__<<":"<<__LINE__<<"]"<<endl; DUMPOUT<<"    "; dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif

void dump_func() {DUMPOUT << endl;};

template <class Head, class... Tail> void dump_func(Head&& head, Tail&&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) DUMPOUT << " ";
    else DUMPOUT << ", ";
    dump_func(std::move(tail)...);
}

//ostream
template<typename T> ostream& operator << (ostream& os, vector<T>& vec) {
    os << "["; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "]";
    return os;
}

template<typename T, typename U> ostream& operator << (ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}

template<typename T, typename U> ostream& operator << (ostream& os, map<T, U>& map_var) {
    os << "[";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")"; itr++;  if(itr != map_var.end()) os << ", "; itr--;
    }
    os << "]";
    return os;
}

template<typename T> ostream& operator << (ostream& os, set<T>& set_var) {
    os << "[";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr; ++itr; if(itr != set_var.end()) os << ", "; itr--;
    }
    os << "]";
    return os;
}

auto start = std::chrono::system_clock::now();
inline double get_time() {
  auto end = std::chrono::system_clock::now();
  auto dur = end - start;
  double msec = std::chrono::duration_cast<std::chrono::milliseconds>(dur).count();
  return msec;
}

double timelimit = 0;
inline bool check_time() {
    auto end = chrono::system_clock::now();
    auto dur = end - start;
    auto msec = chrono::duration_cast<chrono::milliseconds>(dur).count();
    if (msec >= timelimit) return false;
    return true;
}

unsigned long long seed128[4]; //x,y,z,wとして利用
inline void seed(unsigned long long s){
    for(int i=1; i<=4; i++){
        seed128[i-1] = s = 1812433253U * (s^(s>>30)) + i;
    }
}

inline unsigned long long Xor128(){
  unsigned long long t;
  t=(seed128[0]^(seed128[0]<<11));
  seed128[0]=seed128[1];
  seed128[1]=seed128[2];
  seed128[2]=seed128[3];
  seed128[3]=(seed128[3]^(seed128[3]>>19))^(t^(t>>8));
  return seed128[3];
}

constexpr int D = 365;
int c[26];
int s[D+1][26];

int best_score;
short best_ans[D+1];
pair<short, short> best_last[26][D+2];
int cur_score;
short cur_ans[D+1];
pair<short, short> cur_last[26][D+2];

void calc_score(int con, int d, int& score) {
  score += s[d][con];
  rep(i, 26) {
    if (con == i) continue;
    score -= c[i] * (d - best_last[i][d-1].fi);
  }
}

void read() {
  int tmp;
  cin >> tmp;
  rep(i, 26) cin >> c[i];
  rep2(i, 1, D+1)rep(j, 26) cin >> s[i][j];
}

void out() {
  rep2(i, 1, D+1) cout << best_ans[i]+1 << endl;
}

void construct() {
  //greedy
  rep(i, 26) best_last[i][0] = {0, 0};
  rep2(d, 1, D+1) {
    int mx_score = -INF;
    int nx_con = -1;
    rep(con, 26) {
      int tmp_score = best_score;
      calc_score(con, d, tmp_score);
      if (mx_score < tmp_score) {
        mx_score = tmp_score;
        nx_con = con;
      }
    }
    assert(nx_con != -1);
    best_score = mx_score;
    best_ans[d] = nx_con;
    rep(j, 26) {
      if (nx_con == j) {
        best_last[j][d] = {d, d};
        int k = d - 1;
        while (k >= 0) {
          if (best_last[nx_con][k].se != 366) break;
          best_last[nx_con][k].se = d;
          k--;
        }
      }
      else {
        best_last[j][d] = {best_last[j][d-1].fi, 366};
      }
    }
  }
  rep(i, 26) best_last[i][D+1] = {best_last[i][D].fi, 366};
  cerr << best_score << endl;
  /*
  rep(i, D) cerr << "(" << best_last[0][i].fi << "," << best_last[0][i].se << ")" << " ";
  cerr << endl;
  */
}

double w = 0.0;
double startTemp = 1500;
double endTemp = 100;

void NN_2swap(double& temp, int& loop) {
  int d1 = 1 + Xor128() % D;
  int range = 25 - 10 * (endTemp / temp);
  //if (temp < 2*startTemp/3) range = 20;
  //if (temp < startTemp/3) range = 10;
  int diff = 1 + Xor128() % range;
  int co = 1 - 2 * (Xor128() % 2);
  int d2 = d1 + co * (1 + Xor128() % diff);
  if (d2 <= 0 || 365 < d2) return;
  if (d1 == d2) return;
  if (d1 > d2) swap(d1, d2);
  int nx_score = cur_score;
  int c1 = cur_ans[d1];
  int c2 = cur_ans[d2];
  if (c1 == c2) return;
  nx_score -= s[d1][c1];
  nx_score -= s[d2][c2];
  nx_score -= (int)c[c1] * ((int)cur_last[c1][d1+1].se - d1) * (d1 - (int)cur_last[c1][d1-1].fi);
  nx_score -= (int)c[c2] * ((int)cur_last[c2][d2+1].se - d2) * (d2 - (int)cur_last[c2][d2-1].fi);
  //swap
  //cur_last[c1].erase(cur_last[c1].begin() + idx1);
  //cur_last[c2].erase(cur_last[c2].begin() + idx2);
  nx_score += s[d2][c1];
  nx_score += s[d1][c2];
  if (cur_last[c1][d2].fi == d1) {
    nx_score += (int)c[c1] * ((int)cur_last[c1][d2].se - d2) * (d2 - (int)cur_last[c1][d1-1].fi);
  }
  else {
    nx_score += (int)c[c1] * ((int)cur_last[c1][d2].se - d2) * (d2 - (int)cur_last[c1][d2].fi);
  }
  if (cur_last[c2][d1].se == d2) {
    nx_score += (int)c[c2] * ((int)cur_last[c2][d2+1].se - d1) * (d1 - (int)cur_last[c2][d1].fi);
  }
  else {
    nx_score += (int)c[c2] * ((int)cur_last[c2][d1].se - d1) * (d1 - (int)cur_last[c2][d1].fi);
  }
  //cerr << nx_score << endl;

  double now_temp = temp;
  double prob = exp((nx_score - cur_score) / now_temp);
  bool FORCE = prob > (double)(Xor128() % INF) / INF;
  if (FORCE) {
    swap(cur_ans[d1], cur_ans[d2]);
    int l1 = cur_last[c1][d1-1].fi;
    int r1 = cur_last[c1][d1+1].se;
    if (r1 == cur_last[c1][d2].se) {
      cur_last[c1][d2] = {d2, d2};
      rep2(i, l1+1, r1) {
        if (i == d2) continue;
        if (i < d2) cur_last[c1][i] = {l1, d2};
        if (i > d2) cur_last[c1][i] = {d2, r1};
      }
    }
    else {
      rep2(i, l1+1, r1) {
        cur_last[c1][i] = {l1, r1};
      }
      cur_last[c1][d2] = {d2, d2};
      l1 = cur_last[c1][d2-1].fi;
      r1 = cur_last[c1][d2+1].se;
      rep2(i, l1+1, r1) {
        if (i == d2) continue;
        if (i < d2) cur_last[c1][i].se = d2;
        if (i > d2) cur_last[c1][i].fi = d2;
      }
    }
    int l2 = cur_last[c2][d2-1].fi;
    int r2 = cur_last[c2][d2+1].se;
    if (l2 == cur_last[c2][d1].fi) {
      cur_last[c2][d1] = {d1, d1};
      rep2(i, l2+1, r2) {
        if (i == d1) continue;
        if (i < d1) cur_last[c2][i] = {l2, d1};
        if (i > d1) cur_last[c2][i] = {d1, r2};
      }
    }
    else {
      rep2(i, l2+1, r2) {
        cur_last[c2][i] = {l2, r2};
      }
      cur_last[c2][d1] = {d1, d1};
      l2 = cur_last[c2][d1-1].fi;
      r2 = cur_last[c2][d1+1].se;
      rep2(i, l2+1, r2) {
        if (i == d1) continue;
        if (i < d1) cur_last[c2][i].se = d1;
        if (i > d1) cur_last[c2][i].fi = d1;
      }
    }
    cur_score = nx_score;
    if (best_score < cur_score) {
      best_score = cur_score;
      memcpy(best_ans, cur_ans, sizeof(cur_ans));
    }
  }
  else {
    /*
    swap(cur_ans[d1], cur_ans[d2]);
    assert(c1 == cur_ans[d1] && c2 == cur_ans[d2]);
    assert(cur_last[c1][ins1] == d2 && cur_last[c2][ins2] == d1);
    cur_last[c1].erase(cur_last[c1].begin() + ins1);
    cur_last[c2].erase(cur_last[c2].begin() + ins2);
    cur_last[c1].insert(cur_last[c1].begin() + idx1, d1);
    cur_last[c2].insert(cur_last[c2].begin() + idx2, d2);
    assert(cur_last[c1][idx1] == d1 && cur_last[c2][idx2] == d2);
    */
  }
}

constexpr short swap_list[2][10][4] = {
  { {1, 2, 0}, {2, 0, 1}},
  { {1, 0, 3, 2}, {1, 2, 3, 0}, {1, 3, 0, 2}, {2, 0, 3, 1}, {2, 3, 0, 1}, {2, 3, 1, 0}, {3, 0, 1, 2}, {3, 2, 0, 1}, {3, 2, 1, 0}}
};

void NN_k_swap(int K, double& temp, int& loop) {
  pair<short, short> dc[K]; //{day, contest}
  bool add[26] = {};
  int range = 20 - 10 * (endTemp / temp);
  //if (temp < 2*startTemp/3) range = 15;
  //if (temp < startTemp/3) range = 10;
  int center_d = 1 + Xor128() % D;
  int id = 0;
  while (id < K) {
    int diff = 1 + Xor128() % range;
    int co = 1 - 2 * (Xor128() % 2);
    int d1 = center_d + co * diff;
    if (d1 <= 0 || 365 < d1) continue;
    int c1 = cur_ans[d1];
    if (add[c1]) continue;
    add[c1] = true;
    dc[id++] = {d1, c1};
  }
  //sort(all(dc));

  int nx_score = -INF;
  int erase_score = cur_score;
  short nx_d[K];
  rep(i, K) {
    erase_score -= s[dc[i].fi][dc[i].se];
    erase_score -= (int)c[dc[i].se] * ((int)cur_last[dc[i].se][dc[i].fi+1].se - dc[i].fi) * (dc[i].fi - (int)cur_last[dc[i].se][dc[i].fi-1].fi);
  }
  int pattern = 2;
  if (K == 4) pattern = 9;
  rep(i, pattern) {
    int tmp_score = erase_score;
    short tmp_d[K];
    rep(j, K) {
      short idx = swap_list[K-3][i][j];
      short d = dc[j].fi;
      short con = dc[j].se;
      short nd = dc[idx].fi;
      tmp_score += s[nd][con];
      if (cur_last[con][nd].fi == d) {
        tmp_score += (int)c[con] * ((int)cur_last[con][nd].se - nd) * (nd - (int)cur_last[con][d-1].fi);
      }
      else if (cur_last[con][nd].se == d) {
        tmp_score += (int)c[con] * ((int)cur_last[con][d+1].se - nd) * (nd - (int)cur_last[con][nd].fi);
      }
      else {
        tmp_score += (int)c[con] * ((int)cur_last[con][nd].se - nd) * (nd - (int)cur_last[con][nd].fi);
      }
      tmp_d[j] = nd;
    }
    //cerr << tmp_score << endl;
    if (nx_score < tmp_score) {
      nx_score = tmp_score;
      memcpy(nx_d, tmp_d, sizeof(tmp_d));
    }
  }
  //cerr << nx_score << endl;

  double now_temp = temp;
  double prob = exp((nx_score - cur_score) / now_temp);
  bool FORCE = prob > (double)(Xor128() % INF) / INF;
  if (FORCE) {
    rep(i, K) {
      int d = dc[i].fi;
      int con = dc[i].se;
      cur_ans[nx_d[i]] = con;
      int l = cur_last[con][d-1].fi;
      int r = cur_last[con][d+1].se;
      rep2(j, l+1, r) {
        cur_last[con][j] = {l, r};
      }
      cur_last[con][nx_d[i]] = {nx_d[i], nx_d[i]};
      l = cur_last[con][nx_d[i]-1].fi;
      r = cur_last[con][nx_d[i]+1].se;
      rep2(j, l+1, r) {
        if (j == nx_d[i]) continue;
        if (j < nx_d[i]) cur_last[con][j].se = nx_d[i];
        if (j > nx_d[i]) cur_last[con][j].fi = nx_d[i];
      }
    }
    cur_score = nx_score;
    if (best_score < cur_score) {
      best_score = cur_score;
      memcpy(best_ans, cur_ans, sizeof(cur_ans));
    }
  }
  else {
    /*
    swap(cur_ans[d1], cur_ans[d2]);
    assert(c1 == cur_ans[d1] && c2 == cur_ans[d2]);
    assert(cur_last[c1][ins1] == d2 && cur_last[c2][ins2] == d1);
    cur_last[c1].erase(cur_last[c1].begin() + ins1);
    cur_last[c2].erase(cur_last[c2].begin() + ins2);
    cur_last[c1].insert(cur_last[c1].begin() + idx1, d1);
    cur_last[c2].insert(cur_last[c2].begin() + idx2, d2);
    assert(cur_last[c1][idx1] == d1 && cur_last[c2][idx2] == d2);
    */
  }
}
void NN_replace(double& temp) {
  int d = 1 + Xor128() % D;
  int c1 = cur_ans[d];
  int c2 = Xor128() % 26;
  if (c1 == c2) return;
  int nx_score = cur_score;
  nx_score -= s[d][c1];
  nx_score += s[d][c2];
  nx_score -= c[c1] * ((int)cur_last[c1][d+1].se - d) * (d - (int)cur_last[c1][d-1].fi);
  //cur_last[c1].erase(cur_last[c1].begin() + idx1);
  nx_score += c[c2] * ((int)cur_last[c2][d].se - d) * (d - (int)cur_last[c2][d].fi);
  double now_temp = temp;
  double prob = exp((nx_score - cur_score) / now_temp);
  bool FORCE = prob > (double)(Xor128() % INF) / INF;
  //cerr << nx_score << endl;
  if (FORCE) {
    cur_ans[d] = c2;
    int l1 = cur_last[c1][d-1].fi;
    int r1 = cur_last[c1][d+1].se;
    rep2(i, l1+1, r1) {
      cur_last[c1][i] = {l1, r1};
    }
    cur_last[c2][d] = {d, d};
    int l2 = cur_last[c2][d-1].fi;
    int r2 = cur_last[c2][d+1].se;
    rep2(i, l2+1, r2) {
      if (i == d) continue;
      if (i < d) cur_last[c2][i].se = d;
      if (i > d) cur_last[c2][i].fi = d;
    }
    cur_score = nx_score;
    if (best_score < cur_score) {
      best_score = cur_score;
      memcpy(best_ans, cur_ans, sizeof(cur_ans));
    }
  }
  else {
    /*
    cur_ans[d] = c1;
    cur_last[c2].erase(cur_last[c2].begin() + idx2);
    cur_last[c1].insert(cur_last[c1].begin() + idx1, d);
    */
  }
}

void improve() {
  startTemp = 1500;
  endTemp = 100;
  double st_time = get_time();
  timelimit = 1980;
  double SA_limit_time = timelimit - st_time; //SAにかける時間msec
  double temp = startTemp;
  cur_score = best_score;
  memcpy(cur_last, best_last, sizeof(best_last));
  memcpy(cur_ans, best_ans, sizeof(best_ans));
  //double cool = 0.999999995;

  int loop = 0;
  cerr << "before: " << best_score << endl;
  while (true) {
    loop++;
    /*
    if (loop >= 20000000 && loop % 100000 == 0) {
      if (!check_time()) break;
      //temp *= 0.8;
    }
    */
    /*
    if (loop >= 35000000 && loop % 100000 == 0) {
      if (!check_time()) break;
      //temp *= 0.8;
    }
    */
    if (loop % 50000 == 0) {
      double t = get_time() - st_time;
      temp = startTemp + (endTemp - startTemp) * t / SA_limit_time;
    }
    //temp *= cool;
    if (temp <= endTemp) break;
    //近傍
    //NN_2swap(temp, loop);
    //NN_replace(temp);
    int id = Xor128() % 6;
    if (id <= 1) NN_replace(temp);
    else if (id <= 3) NN_2swap(temp, loop);
    else if (id == 4) NN_k_swap(3, temp, loop);
    else if (id == 5) NN_k_swap(4, temp, loop);
    /*
    int id = Xor128() % 12;
    if (id <= 5) NN_replace(temp);
    else if (id <= 8) NN_2swap(temp, loop);
    else if (id <= 10) NN_k_swap(3, temp, loop);
    else if (id == 11) NN_k_swap(4, temp, loop);
    */
    /*
    if (loop % 1000000 == 0) {
      cerr << loop << " " << cur_score << " " << best_score << " " << temp << endl;
    }
    */
  }
  cerr << loop << " "  << temp << endl;
  cerr << "after: " << best_score << endl;
}

void solve() {
  construct();
  improve();
}

signed main() {
  seed(37);
  read();
  solve();
  out();
}


Measured memory_bytes: 4460