#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")

#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <unordered_set>
#include <random>
#include <cmath>
#include <cassert>

struct xorshift64 {
  unsigned long long int x = 88172645463325252ULL;
  inline unsigned short nextUShort() {
    x = x ^ (x << 7);
    return x = x ^ (x >> 9);
  }
  inline unsigned int nextUShortMod(unsigned long long int mod) {
    x = x ^ (x << 7);
    x = x ^ (x >> 9);
    return ((x & 0x000000000000ffff) * mod) >> 48;
  }
  inline unsigned int nextUInt() {
    x = x ^ (x << 7);
    return x = x ^ (x >> 9);
  }
  inline unsigned int nextUIntMod(unsigned long long int mod) {
    x = x ^ (x << 7);
    x = x ^ (x >> 9);
    return ((x & 0x00000000ffffffff) * mod) >> 32;
  }
  inline unsigned long long int nextULL() {
    x = x ^ (x << 7);
    return x = x ^ (x >> 9);
  }
  inline double nextDouble() {
    x = x ^ (x << 7);
    x = x ^ (x >> 9);
    return (double)x * 5.42101086242752217e-20;
  }
};

struct timer {
  double t = 0.0;
  double lastStop = 0.0;
  bool stopped = false;
  timer() {
    restart();
  }
  inline void restart() {
    t = now();
    stopped = false;
  }
  inline void start() {
    if (stopped) {
      t += now() - lastStop;
      stopped = false;
    }
  }
  inline void stop() {
    if (!stopped) {
      lastStop = now();
      stopped = true;
    }
  }
  inline double time() {
    if (stopped) return lastStop - t;
    else return now() - t;
  }
  inline double now() {
    unsigned long long l, h;
    __asm__ ("rdtsc" : "=a"(l), "=d"(h));
    #ifdef LOCAL
    return (double)(l | h << 32) * 2.857142857142857e-10; // 1 / 3.5e9, for local (Ryzen 9 3950X)
    #else
    //return (double)(l | h << 32) * 3.5714285714285715e-10; // 1 / 2.8e9, for AWS EC2 C3 (Xeon E5-2680 v2)
    //return (double)(l | h << 32) * 3.4482758620689656e-10; // 1 / 2.9e9, for AWS EC2 C4 (Xeon E5-2666 v3)
    return (double)(l | h << 32) * 3.333333333333333e-10; // 1 / 3.0e9, for AWS EC2 C5 (Xeon Platinum 8124M / Xeon Platinum 8275CL)
    #endif
  }
};

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

timer theTimer;
xorshift64 theRandom;

//#define DEBUG

constexpr int d = 365;
constexpr int t = 26;
vector<int> c(t);
vector<vector<int> > s(t, vector<int>(d));

vector<int> contests(d);

vector<vector<short> > last(t, vector<short>(d+1, -1));
vector<vector<int> > happiness(t, vector<int>(d+1, 0));

vector<vector<short> > last_before(t, vector<short>(d+1, -1));
vector<vector<int> > happiness_before(t, vector<int>(d+1, 0));

void greedySelect() {
  vector<int> lastChosen(26, -1);
  for (int i = 0; i < d; i++) {
    vector<int> penalty(26);
    int penaltyTotal = 0;
    for (int j = 0; j < t; j++) {
      penalty[j] = c[j] * (i - lastChosen[j]);
      penaltyTotal += penalty[j];
    }
    int bestContest = 0;
    int bestScore = -penaltyTotal;
    for (int j = 0; j < t; j++) {
      int score = -penaltyTotal + penalty[j] + s[j][i];
      if (score > bestScore) {
        bestContest = j;
        bestScore = score;
      }
    }
    contests[i] = bestContest;
    lastChosen[bestContest] = i;
  }
}

void greedySelect2() {
  for (int i = 0; i < d; i++) {
    int bestContest = 0;
    int bestScore = 0;
    for (int j = 0; j < t; j++) {
      if (s[j][i] > bestScore) {
        bestContest = j;
        bestScore = s[j][i];
      }
    }
    contests[i] = bestContest;
  }
}

int updateHappiness(int day, int con) {
  for (int i = day; i < d; i++) {
    happiness[con][i+1] = happiness[con][i];
    last[con][i+1] = last[con][i];
    if (contests[i] == con) {
      happiness[con][i+1] += s[con][i];
      last[con][i+1] = i;
    }
    else {
      happiness[con][i+1] -= c[con] * (i - last[con][i]);
    }
  }
  return happiness[con][d];
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  // input
  int _d;
  cin >> _d;
  for (auto &x: c) cin >> x;
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < t; j++) cin >> s[j][i];
  }

  // preprocessing
  greedySelect();
  int score = 0;
  for (int i = 0; i < t; i++) score += updateHappiness(0, i);

  last_before = last;
  happiness_before = happiness;

  // optimization
  int lastScore = score;
  int bestScore = score;

  double baseTemperature = 2e3;
  double temperature = baseTemperature;
  double decayRate = 5e-7;
  double timeLimit = 1.980;
  int iterCount = 0;

  while (theTimer.time() < timeLimit) {
    int day = theRandom.nextUIntMod(d);
    int con = theRandom.nextUIntMod(t);
    if (contests[day] == con) continue;

    int contest_before = contests[day];
    contests[day] = con;
    score -= happiness[contest_before][d];
    score += updateHappiness(day, contest_before);
    score -= happiness[con][d];
    score += updateHappiness(day, con);

    #ifdef DEBUG
    if (iterCount % 100000 == 0) cerr << iterCount << " " << score << " " << lastScore << " " << bestScore << " " << temperature << " " << theTimer.time() << endl;
    #endif

    if (score >= lastScore) {
      lastScore = score;
      for (int i = day; i < d; i++) {
        last_before[contest_before][i+1] = last[contest_before][i+1];
        happiness_before[contest_before][i+1] = happiness[contest_before][i+1];
        last_before[con][i+1] = last[con][i+1];
        happiness_before[con][i+1] = happiness[con][i+1];
      }
      if (score > bestScore) {
        bestScore = score;
      }
    }
    else if (theRandom.nextDouble() < exp(double(score - lastScore) / temperature)) { // accept
      lastScore = score;
      for (int i = day; i < d; i++) {
        last_before[contest_before][i+1] = last[contest_before][i+1];
        happiness_before[contest_before][i+1] = happiness[contest_before][i+1];
        last_before[con][i+1] = last[con][i+1];
        happiness_before[con][i+1] = happiness[con][i+1];
      }
    }
    else { // rollback
      contests[day] = contest_before;
      for (int i = day; i < d; i++) {
        last[contest_before][i+1] = last_before[contest_before][i+1];
        happiness[contest_before][i+1] = happiness_before[contest_before][i+1];
        last[con][i+1] = last_before[con][i+1];
        happiness[con][i+1] = happiness_before[con][i+1];
      }
      score = lastScore;
    }

    iterCount++;
    temperature *= 1.0 - decayRate;
  }

  cerr << "iterCount   = " << iterCount << endl;
  cerr << "temperature = " << temperature << endl;
  cerr << "score       = " << score << endl;
  cerr << "bestScore   = " << bestScore << endl;

  // postprocess & output
  for (auto &x: contests) cout << x+1 << endl;

  return 0;
}


Measured memory_bytes: 4612