#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];
vector<int> idx(26, 0);

int best_score;
vector<short> best_ans(D+1);
vector<vector<pair<short, short>>> best_last(26, vector<pair<short, short>>(D+2));
int cur_score;
vector<short> cur_ans(D+1);
vector<vector<pair<short, short>>> cur_last(26, vector<pair<short, short>>(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;

void NN_swap(double& temp, int& loop) {
  int d1 = 1 + Xor128() % D;
  int range = 25;
  if (loop > 10000000) range = 20;
  if (loop > 20000000) 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];
  assert((int)cur_last[c1][d1+1].se > d1);
  assert(d1 > (int)cur_last[c1][d1-1].fi);
  assert((int)cur_last[c2][d2+1].se > d2);
  assert(d2 > (int)cur_last[c2][d2-1].fi);
  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) {
    assert((int)cur_last[c1][d2].se > d2);
    assert(d2 > (int)cur_last[c1][d1-1].fi);
    nx_score += (int)c[c1] * ((int)cur_last[c1][d2].se - d2) * (d2 - (int)cur_last[c1][d1-1].fi);
  }
  else {
    assert((int)cur_last[c1][d2].se > d2);
    assert(d2 > (int)cur_last[c1][d2].fi);
    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) {
    assert((int)cur_last[c2][d2+1].se > d1);
    assert(d1 > (int)cur_last[c2][d1].fi);
    nx_score += (int)c[c2] * ((int)cur_last[c2][d2+1].se - d1) * (d1 - (int)cur_last[c2][d1].fi);
  }
  else {
    assert((int)cur_last[c2][d1].se > d1);
    assert(d1 > (int)cur_last[c2][d1].fi);
    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;
      best_ans = 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;
      best_ans = 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() {
  double startTemp = 900;
  double endTemp = 0;
  double st_time = get_time();
  timelimit = 1980;
  double SA_limit_time = timelimit - st_time; //SAにかける時間msec
  double temp = startTemp;
  cur_score = best_score;
  cur_last = best_last;
  cur_ans = 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 >= 20000000 && loop % 100000 == 0) {
      if (!check_time()) break;
      //temp *= 0.8;
    }
    //double t = get_time() - st_time;
    //double temp = startTemp + (endTemp - startTemp) * t / SA_limit_time;
    //temp *= cool;
    //if (temp <= 0) break;
    //近傍
    NN_swap(temp, loop);
    NN_replace(temp);
    //int id = Xor128() % 2;
    //if (id == 0) NN_replace(temp);
    //else NN_swap(temp, loop);
    /*
    if (loop % 10000 == 0) {
      cerr << loop << " " << cur_score << " " << best_score << " " << temp << " " << update_cnt << endl;
    }
    */
  }
  cerr << loop << " "  << temp << endl;
  cerr << "after: " << best_score << endl;
}

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

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


Measured memory_bytes: 4492