#include<cstdio>
#include<set>
#include<cstdlib>
#include<chrono>
#include<vector>
#include<utility>

using namespace std;

int d, c[100], s[400][100];
set<int> app[100];

int last(int d, int i) {
  return *(--app[i].upper_bound(d));
}

int next(int d, int i) {
  return *app[i].upper_bound(d);
}

int random(int x, int y) {
  return rand() % (y - x + 1) + x;
}

pair<int, vector<int>> init(auto start) {
  int sat = 0;
  vector<int> t(1);
  for (int i = 1; i <= 26; i++) {
    app[i].clear();
    app[i].insert(0);
    app[i].insert(d+1);
  }
  for (int ii = 1; ii <= d; ii++) {
    int best = -2e9, best_j = 0;
    for (int j = 1; j <= 26; j++) {
       int tmp = 0;
       tmp += s[ii][j];
       for (int k = 1; k <= 26; k++) {
         if (j == k) {
           continue;
         }
         tmp -= c[k] * (ii - last(ii, k));
       }
       if (tmp > best) {
         best = tmp;
         best_j = j;
       }
    }
    t.push_back(best_j);
    sat += s[ii][t[ii]];
    app[t[ii]].insert(ii);
    for (int j = 1; j <= 26; j++) {
      sat -= c[j] * (ii - last(ii, j));
    }
    auto end = chrono::steady_clock::now();
    while (chrono::duration_cast<chrono::nanoseconds>(end - start).count() < 1.9e9) {
      int best = -2e9, best_i = 0, best_j = 0;
      for (int i = 1; i <= ii; i++) {
        for (int j = 1; j <= 26; j++) {
          if (j == t[i]) {
            continue;
          }
          int tmp = 0;
          tmp -= s[i][t[i]];
          tmp -= c[t[i]] * (next(i, t[i]) - i) * (i - last(i - 1, t[i]));

          tmp += s[i][j];
          tmp += c[j] * (next(i, j) - i) * (i - last(i, j));
          if (tmp > best) {
            best = tmp;
            best_i = i;
            best_j = j;
          }
        }
      }
      if (best > 0) {
        app[t[best_i]].erase(best_i);
        app[best_j].insert(best_i);
        t[best_i] = best_j;
        sat += best;
      } else {
        break;
      }
      end = chrono::steady_clock::now();
    }
  }
  return {sat, t};
}

pair<int, vector<int>> climb(auto start, int sat, vector<int> t) {
  auto end = chrono::steady_clock::now();
  while (chrono::duration_cast<chrono::nanoseconds>(end - start).count() < 1.9e9) {
    int best = -2e9, best_i = 0, best_j = 0;
    for (int i = 1; i <= d; i++) {
      for (int j = 1; j <= 26; j++) {
        if (j == t[i]) {
          continue;
        }
        int tmp = 0;
        tmp -= s[i][t[i]];
        tmp -= c[t[i]] * (next(i, t[i]) - i) * (i - last(i - 1, t[i]));

        tmp += s[i][j];
        tmp += c[j] * (next(i, j) - i) * (i - last(i, j));
        if (tmp > best) {
          best = tmp;
          best_i = i;
          best_j = j;
        }
      }
    }
    if (best > 0) {
      app[t[best_i]].erase(best_i);
      app[best_j].insert(best_i);
      t[best_i] = best_j;
      sat += best;
    } else {
      break;
    }
    end = chrono::steady_clock::now();
  }
  return {sat, t};
}

int main() {
  scanf("%d", &d);
  for (int i = 1; i <= 26; i++) {
    scanf("%d", &c[i]);
  }
  for (int i = 1; i <= d; i++) {
    for (int j = 1; j <= 26; j++) {
      scanf("%d", &s[i][j]);
    }
  }
  auto start = chrono::steady_clock::now();
  auto tmp = init(start);
  auto res = climb(start, tmp.first, tmp.second);
  auto ans = res;
  for (int i = 1; i <= d; i++) {
    printf("%d\n", ans.second[i]);
  }
}


Measured memory_bytes: 3512