#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(d, vector<int>(t));

vector<int> contests(d);

vector<vector<int> > last(d+1, vector<int>(t, -1));
vector<vector<int> > happiness(d+1, vector<int>(t, 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[i][j];
      if (score > bestScore) bestContest = j;
    }
    contests[i] = bestContest;
    lastChosen[bestContest] = i;
  }
}

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

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

  // input
  int _d;
  cin >> _d;
  for (auto &x: c) cin >> x;
  for (auto &x: s) {
    for (auto &y: x) cin >> y;
  }

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

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

  double baseTemperature = 1e4;
  double temperature = baseTemperature;
  double decayRate = 5e-6;
  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[d][contest_before];
    score += updateHappiness(day, contest_before);
    score -= happiness[d][con];
    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;
      if (score > bestScore) {
        bestScore = score;
      }
    }
    else if (theRandom.nextDouble() < exp(double(score - lastScore) / temperature)) { // accept
      lastScore = score;
    }
    else { // rollback
      contests[day] = contest_before;
      updateHappiness(day, contest_before);
      updateHappiness(day, con);
      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: 4580