#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

double TIME_LIMIT = 2.0;
ll startCycle;
const ll CYCLE_PER_SEC = 2700000000;

unsigned long long xor128() {
  static unsigned long long rx = 123456789, ry = 362436069, rz = 521288629, rw = 88675123;
  unsigned long long rt = (rx ^ (rx << 11));
  rx = ry;
  ry = rz;
  rz = rw;
  return (rw = (rw ^ (rw >> 19)) ^ (rt ^ (rt >> 8)));
}

unsigned long long int getCycle() {
  unsigned int low, high;
  __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
  return ((unsigned long long int) low) | ((unsigned long long int) high << 32);
}

double getTime(unsigned long long int begin_cycle) {
  return (double) (getCycle() - begin_cycle) / CYCLE_PER_SEC;
}

const int MAX_D = 365;
const int MAX_CONTEST_NUM = 26;

int D;
int C[MAX_CONTEST_NUM];
int S[MAX_D][MAX_CONTEST_NUM];
int schedule[MAX_D];

class ACS {
public:
  void init() {
    fprintf(stderr, "init =>\n");
    memset(schedule, -1, sizeof(schedule));

    for (int d = 0; d < D; ++d) {
      schedule[d] = d % MAX_CONTEST_NUM;
    }
  }

  void run() {
    init();
    startCycle = getCycle();

    searchBestContestSchedule();

    int score = calcScoreRaw();
    fprintf(stderr, "calcScore: %d\n", score);
  }

  void searchBestContestSchedule() {
    int bestSchedule[MAX_D];
    memcpy(bestSchedule, schedule, sizeof(schedule));
    int bestScore = calcScore();
    int currentScore = bestScore;

    int R = 500000;
    double k = 1.0;
    int tryCount = 0;

    double currentTime = getTime(startCycle);
    int i, j;

    while (currentTime < TIME_LIMIT) {
      currentTime = getTime(startCycle);
      double remainTime = (TIME_LIMIT - currentTime) / TIME_LIMIT;

      int type = xor128() % 2;

      do {
        i = xor128() % D;
        j = xor128() % D;
      } while (i == j);

      int bc = schedule[i];
      int nc = xor128() % MAX_CONTEST_NUM;

      switch(type) {
        case 0:
          swapSchedule(i, j);
          break;
        case 1:
          changeContest(i, nc);
          break;
      }

      int score = calcScore();
      int diffScore = score - currentScore;

      if (diffScore > 0 || (xor128() % R < R * exp(diffScore / (k * sqrt(remainTime))))) {
        currentScore = score;

        if (bestScore < score) {
          bestScore = score;
          memcpy(bestSchedule, schedule, sizeof(schedule));
        }
      } else {
        switch(type) {
          case 0:
            swapSchedule(i, j);
            break;
          case 1:
            changeContest(i, bc);
            break;
        }
      }

      ++tryCount;
    }

    fprintf(stderr, "tryCount: %d, bestScore: %d\n", tryCount, bestScore);

    memcpy(schedule, bestSchedule, sizeof(bestSchedule));
  }

  void swapSchedule(int i, int j) {
    swap(schedule[i], schedule[j]);
  }

  void changeContest(int i, int c) {
    schedule[i] = c;
  }

  int calcScore() {
    int satisfaction = 0;
    int unsatisfaction = 0;
    int lastDay[MAX_CONTEST_NUM];
    memset(lastDay, 0, sizeof(lastDay));

    for (int d = 0; d < D; ++d) {
      int t = schedule[d];
      satisfaction += S[d][t];
      lastDay[t] = (d + 1);

      for (int c = 0; c < MAX_CONTEST_NUM; ++c) {
        unsatisfaction += C[c] * (d + 1 - lastDay[c]);
      }
    }

    return satisfaction - unsatisfaction;
  }

  int calcScoreRaw() {
    int satisfaction = 0;
    int unsatisfaction = 0;
    int lastDay[MAX_CONTEST_NUM];
    memset(lastDay, 0, sizeof(lastDay));

    for (int d = 0; d < D; ++d) {
      int t = schedule[d];
      assert(0 <= t && t < MAX_CONTEST_NUM);
      satisfaction += S[d][t];
      lastDay[t] = (d + 1);

      for (int c = 0; c < MAX_CONTEST_NUM; ++c) {
        unsatisfaction += C[c] * (d + 1 - lastDay[c]);
      }
    }

    int baseScore = 1000000;
    return max(baseScore + satisfaction - unsatisfaction, 0);
  }
};

int main() {
  cin >> D;

  int c;
  for (int i = 0; i < MAX_CONTEST_NUM; ++i) {
    cin >> c;
    C[i] = c;
  }

  for (int d = 0; d < D; ++d) {
    int s;
    for (int j = 0; j < MAX_CONTEST_NUM; ++j) {
      cin >> s;
      S[d][j] = s;
    }
  }

  ACS acs;
  acs.run();

  for (int i = 0; i < D; ++i) {
    cout << schedule[i] + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 4340