#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

const ll mod = 1e9 + 7;

using std::chrono::system_clock;

int D;
int C[26];
std::vector<std::vector<int>> S;
const int INF = 1e9;

std::vector<int> T;
std::vector<std::set<int>> T2;
int calced_score;

system_clock::time_point start;

void init() {
  std::cin >> D;
  REP(i, 26) std::cin >> C[i];
  S.resize(D);
  REP(i, D) {
    S[i].resize(26);
    REP(j, 26) std::cin >> S[i][j];
  }

  T.resize(D, -1);
  T2.resize(26);
}

std::vector<int> prev_days;

int calc_score(std::vector<int> &contests, bool verbose = false) {
  int score = 0;
  prev_days.assign(26, -1);
  REP(i, contests.size()) {
    prev_days[contests[i]] = i;
    if (verbose) {
      for (int d : prev_days) std::cerr << d << ' ';
      std::cerr << endl;
    }
    REP(j, 26) {
      score -= C[j] * (i - prev_days[j]);
    }
    score += S[i][contests[i]];
    if (verbose) {
      std::cerr << score << std::endl;
    }
  }
  return score;
}

void output() {
  for (int t : T) std::cout << t + 1 << '\n';
}

void greedy() {
  std::vector<int> contests;
  REP(d, D) {
    int max_score = -INF, max_con = -1;
    REP(i, 26) {
      contests.emplace_back(i);
      int new_score = calc_score(contests);
      if (new_score > max_score) {
        max_score = new_score;
        max_con = i;
      }
      contests.pop_back();
    }
    contests.emplace_back(max_con);
  }
  T = contests;
  calced_score = calc_score(T);
  std::cerr << calced_score << endl;
}

void init_set() {
  //REP(i, 26) T2[i].clear();
  REP(i, D) T2[T[i]].insert(i);
}

inline int score_day_diff(int day1, int day2) {
  return (day2 - day1) * (day2 - day1 - 1) / 2;
}

void show_set() {
  for (int d : T) std::cerr << d << ' ';
  std::cerr << std::endl;
  REP(i, 26) {
    std::cerr << i << ": {";
    for (int d : T2[i]) std::cerr << d << ',';
    std::cerr << '}' << std::endl;
  }
}

int calc_updated_score(int day, int con1, int con2) {
  // ある日 day を con1 から con2 に変更したときのスコア
  //std::cerr << day << ':' << con1 << "->" << con2 << std::endl;
  int score = calced_score;

  auto it = T2[con1].find(day);
  assert(it != T2[con1].end());
  int prev_day = -1;
  if (it != T2[con1].begin()) {
    prev_day = *prev(it);
  }
  int next_day = D;
  auto next_it = next(it);
  if (next_it != T2[con1].end()) {
    next_day = *next_it;
  }
  //std::cerr << prev_day << "," << next_day << std::endl;
  //std::cerr << "prev/next" << std::endl;

  score += (score_day_diff(prev_day, day)
            + score_day_diff(day, next_day)
            - score_day_diff(prev_day, next_day)) * C[con1] - S[day][con1];

  T2[con1].erase(it);
  it = T2[con2].lower_bound(day);
  prev_day = -1;
  if (it != T2[con2].begin()) {
    prev_day = *prev(it);
  }
  next_day = D;
  if (it != T2[con2].end()) {
    next_day = *it;
  }

  score += (score_day_diff(prev_day, next_day)
            - score_day_diff(prev_day, day)
            - score_day_diff(day, next_day)) * C[con2] + S[day][con2];
  //std::cerr << prev_day << "," << next_day << std::endl;

  T2[con1].insert(day);
  //std::cerr << "prev/next" << std::endl;

  return score;
}

bool update_greedy() {
  int score = calced_score;
  bool is_updated = false;
  int day = -1, cont = -1;
  REP(d, D) {
    REP(i, 26) {
      //init_set();
      int tmp = T[d];
      T[d] = i;
      int new_score = calc_updated_score(d, tmp, i);
      ///*
      //std::cerr << new_score << ' ' << calc_score(T) << std::endl;
      T[d] = tmp;
      //*/
      if (new_score > score) {
        score = new_score;
        is_updated = true;
        day = d, cont = i;
      }
    }
  }
  //std::cerr << std::endl;
  if (is_updated) {
    T2[T[day]].erase(day);
    T2[cont].insert(day);
    T[day] = cont, calced_score = score;
  }
  return is_updated;
}

void greedy2() {
  init_set();
  while (true) {
    double diff = std::chrono::duration_cast<std::chrono::milliseconds>(
        system_clock::now() - start).count() / 1000.;
    if (diff > 1.9) break;
    //show_set();
    if (not update_greedy()) {
      break;
    }
  }
  std::cerr << calced_score << endl;
}

const int K_BEAM = 10;
const int CHANGE_SIZE = 10;

void beam_search() {
  std::vector<std::tuple<int, std::vector<int>, std::vector<std::set<int>>>> cands;
  cands.push_back(std::make_tuple(-calced_score, T, T2));
  std::random_device rnd;
  std::mt19937 mt(rnd());

  std::uniform_int_distribution<> randD(0, D-1), rand26(0, 25);
  int update_count = 0;

  while (true) {
    double diff = std::chrono::duration_cast<std::chrono::milliseconds>(
        system_clock::now() - start).count() / 1000.;
    if (diff > 1.975) break;
    std::vector<std::tuple<int, std::vector<int>, std::vector<std::set<int>>>> new_cands = cands;
    REP(t, CHANGE_SIZE) {
      for (auto p : cands) {
        int score; std::vector<int> cand_T; std::vector<set<int>> cand_T2; std::tie(score, cand_T, cand_T2) = p;
        int day = randD(mt), con = rand26(mt);
        if (cand_T[day] == con) continue;
        calced_score = -score, T2 = cand_T2;

        int new_score = calc_updated_score(day, cand_T[day], con);
        //std::cerr << day << ' ' << con << ' ' << new_score << std::endl;

        cand_T2[cand_T[day]].erase(day);
        cand_T2[con].insert(day);
        cand_T[day] = con;

        new_cands.emplace_back(-new_score, cand_T, cand_T2);
      }
    }
    update_count++;

    sort(ALL(new_cands));
    new_cands.resize(std::min<int>(new_cands.size(), K_BEAM));
    cands = new_cands;
  }

  std::tie(calced_score, T, T2) = cands[0];
  calced_score *= -1;
  std::cerr << calced_score << ' ' << update_count << std::endl;
  for (auto &p : cands) std::cerr << -std::get<0>(p) << ' ';
  std::cerr << std::endl;
}

int main() {
  start = system_clock::now();

  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  init();

  greedy();
  greedy2();
  beam_search();

  output();

  return 0;
}


Measured memory_bytes: 6152