#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 (short i=0;i<(n);i++)
#define rep2(i,a,b) for (short 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 short D = 365;
short c[26];
short s[D+1][26];
vector<short> idx(26, 0);

int best_score;
vector<short> best_ans(D+1);
vector<vector<short>> best_last(26, vector<short>(30+2, 0));
int cur_score;
vector<short> cur_ans(D+1);
vector<vector<short>> cur_last(26, vector<short>(30+2, 0));

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][idx[i]]);
  }
}

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
  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;
    best_last[nx_con][++idx[nx_con]] = d;
  }
  cerr << best_score << endl;
}

double w = 0.0;

void NN_swap(double& temp, int& update_cnt) {
  int d1 = 1 + Xor128() % D;
  int range = 20;
  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;
  int idx1 = -1;
  int idx2 = -1;
  bool ok1 = false;
  bool ok2 = false;
  rep(i, D+1) {
    if (!ok1 && d1 == cur_last[c1][i]) {
      idx1 = i;
      ok1 = true;
      if (ok1 && ok2) break;
    }
    if (!ok2 && d2 == cur_last[c2][i]) {
      idx2 = i;
      ok2 = true;
      if (ok1 && ok2) break;
    }
  }
  assert(idx1 != -1);
  assert(idx2 != -1);
  nx_score -= s[d1][c1];
  nx_score -= s[d2][c2];
  if (cur_last[c1][idx1+1] != 0) {
    nx_score -= c[c1] * (cur_last[c1][idx1+1] - d1) * (d1 - cur_last[c1][idx1-1]);
  }
  else {
    nx_score -= c[c1] * (366 - d1) * (d1 - cur_last[c1][idx1-1]);
  }
  if (cur_last[c2][idx2 + 1] != 0) {
    nx_score -= c[c2] * (cur_last[c2][idx2+1] - d2) * (d2 - cur_last[c2][idx2-1]);
  }
  else {
    nx_score -= c[c2] * (366 - d2) * (d2 - cur_last[c2][idx2-1]);
  }
  //swap
  //cur_last[c1].erase(cur_last[c1].begin() + idx1);
  //cur_last[c2].erase(cur_last[c2].begin() + idx2);
  int ins1 = 0;
  int ins2 = 0;
  ok1 = false;
  ok2 = false;
  bool passed1 = false;
  bool passed2 = false;
  rep2(i, 1, D+1) {
    if (!ok1 && cur_last[c2][i-1] < d1) {
      if (i > idx2) passed2 = true;
      if (d1 < cur_last[c2][i] || cur_last[c2][i] == 0) {
        //cur_last[c2].insert(cur_last[c2].begin() + i, d1);
        ins2 = i;
        ok1 = true;
        if (ok1 && ok2) break;
      }
    }
    if (!ok2 && cur_last[c1][i-1] < d2) {
      if (i > idx1) passed1 = true;
      if (d2 < cur_last[c1][i] || cur_last[c1][i] == 0) {
        //cur_last[c1].insert(cur_last[c1].begin() + i, d2);
        ins1 = i;
        ok2 = true;
        if (ok1 && ok2) break;
      }
    }
  }
  nx_score += s[d2][c1];
  nx_score += s[d1][c2];
  if (ins1 == idx1) {
    if (cur_last[c1][ins1+1] == 0) {
      nx_score += c[c1] * (366 - d2) * (d2 - cur_last[c1][ins1-1]);
    }
    else {
      nx_score += c[c1] * (cur_last[c1][ins1+1] - d2) * (d2 - cur_last[c1][ins1-1]);
    }
  }
  else if (ins1 == idx1+1) {
    if (cur_last[c1][ins1] == 0) {
      nx_score += c[c1] * (366 - d2) * (d2 - cur_last[c1][ins1-2]);
    }
    else {
      nx_score += c[c1] * (cur_last[c1][ins1] - d2) * (d2 - cur_last[c1][ins1-2]);
    }
  }
  else {
    if (cur_last[c1][ins1] == 0) {
      nx_score += c[c1] * (366 - d2) * (d2 - cur_last[c1][ins1-1]);
    }
    else {
      nx_score += c[c1] * (cur_last[c1][ins1] - d2) * (d2 - cur_last[c1][ins1-1]);
    }
  }

  if (ins2 == idx2) {
    if (cur_last[c2][ins2+1] == 0) {
      nx_score += c[c2] * (366 - d1) * (d1 - cur_last[c2][ins2-1]);
    }
    else {
      nx_score += c[c2] * (cur_last[c2][ins2+1] - d1) * (d1 - cur_last[c2][ins2-1]);
    }
  }
  else if (ins2 == idx2+1) {
    if (cur_last[c2][ins2] == 0) {
      nx_score += c[c2] * (366 - d1) * (d1 - cur_last[c2][ins2-2]);
    }
    else {
      nx_score += c[c2] * (cur_last[c2][ins2] - d1) * (d1 - cur_last[c2][ins2-2]);
    }
  }
  else {
    if (cur_last[c2][ins2] == 0) {
      nx_score += c[c2] * (366 - d1) * (d1 - cur_last[c2][ins2-1]);
    }
    else {
      nx_score += c[c2] * (cur_last[c2][ins2] - d1) * (d1 - cur_last[c2][ins2-1]);
    }
  }
  //cerr << nx_score << endl;

  double now_temp = temp + w * update_cnt;
  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]);
    cur_last[c1].erase(cur_last[c1].begin() + idx1);
    cur_last[c2].erase(cur_last[c2].begin() + idx2);
    if (passed1) ins1--;
    if (passed2) ins2--;
    cur_last[c1].insert(cur_last[c1].begin() + ins1, d2);
    cur_last[c2].insert(cur_last[c2].begin() + ins2, d1);
    cur_score = nx_score;
    update_cnt = 0;
    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& update_cnt) {
  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];
  int idx1 = -1;
  rep(i, D+1) {
    if (d == cur_last[c1][i]) {
      idx1 = i;
      break;
    }
  }
  assert(idx1 != -1);
  if (cur_last[c1][idx1+1] != 0) {
    nx_score -= c[c1] * (cur_last[c1][idx1+1] - d) * (d - cur_last[c1][idx1-1]);
  }
  else {
    nx_score -= c[c1] * (366 - d) * (d - cur_last[c1][idx1-1]);
  }
  //cur_last[c1].erase(cur_last[c1].begin() + idx1);
  int idx2 = -1;
  rep2(i, 1, D+1) {
    if (cur_last[c2][i-1] < d) {
      if (d < cur_last[c2][i] || cur_last[c2][i] == 0) {
        //cur_last[c2].insert(cur_last[c2].begin() + i, d);
        idx2 = i;
        break;
      }
    }
  }
  if (cur_last[c2][idx2] != 0) {
    nx_score += c[c2] * (cur_last[c2][idx2] - d) * (d - cur_last[c2][idx2-1]);
  }
  else {
    nx_score += c[c2] * (366 - d) * (d - cur_last[c2][idx2-1]);
  }
  double now_temp = temp + w * update_cnt;
  double prob = exp((nx_score - cur_score) / now_temp);
  bool FORCE = prob > (double)(Xor128() % INF) / INF;
  if (FORCE) {
    cur_ans[d] = c2;
    cur_last[c1].erase(cur_last[c1].begin() + idx1);
    cur_last[c2].insert(cur_last[c2].begin() + idx2, d);
    update_cnt = 0;
    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 = 1000;
  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.99;

  int loop = 0;
  int update_cnt = 0;
  cerr << "before: " << best_score << endl;
  while (true) {
    loop++;
    update_cnt++;
    if (loop >= 20000000 && loop % 100000 == 0) {
      if (!check_time()) break;
      //temp *= 0.9;
    }
    //double t = get_time() - st_time;
    //double temp = startTemp + (endTemp - startTemp) * t / SA_limit_time;
    //temp *= cool;
    //if (temp <= 0) break;
    //近傍
    int id = Xor128() % 2;
    if (id == 0) NN_replace(temp, update_cnt);
    else NN_swap(temp, update_cnt);

    //NN_swap(temp);
    //NN_insert(temp);
    // if (id == 2) NN_insert(temp);
    //if (id == 0) NN_swap(temp);
    //if (id == 1) NN_insert(temp);
    //if (id == 2) NN_replace(temp);
    /*
    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: 4224