/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;
constexpr int64_t kMod1 = 1000000007LL;
constexpr int64_t kMod2 = 998244353LL;
constexpr int64_t kMod3 = 3571L;

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

  constexpr int64_t kN = 26;
  int64_t D;
  cin >> D;
  vector<int64_t> C(kN + 1, 0);
  for (int64_t c = 1; c <= kN; ++c) {
    cin >> C[c];
  }
  vector<vector<int64_t>> S(D + 1, vector<int64_t>(kN + 1));
  for (int64_t d = 1; d <= D; ++d) {
    for (int64_t c = 1; c <= kN; ++c) {
      cin >> S[d][c];
    }
  }
  vector<vector<int64_t>> last(D + 1, vector<int64_t>(kN + 1, 0));
  vector<int64_t> contests(D + 1);
  for (int64_t d = 1; d <= D; ++d) {
    cin >> contests[d];
  }

  auto Score = [&](const int64_t day) -> int64_t {
    int64_t score = 0;
    for (int64_t d = 1; d <= day; ++d) {
      last[d] = last[d - 1];
      last[d][contests[d]] = d;
      score += S[d][contests[d]];
      for (int64_t c = 1; c <= kN; ++c) {
        score -= C[c] * (d - last[d][c]);
      }
    }
    return score;
  };

  auto OutputResults = [&]() {
    for (int64_t d = 1; d <= D; ++d) {
      cout << contests[d] << endl;
    }
  };

  for (int64_t d = 1; d <= D; ++d) {
    int64_t best_score = INT64_MIN;
    int64_t best_conte = -1;
    for (int64_t c = 1; c <= kN; ++c) {
      contests[d] = c;
      int64_t temp_score = Score(d);
      if (temp_score > best_score) {
        best_score = temp_score;
        best_conte = c;
      }
    }
    contests[d] = best_conte;
  }

  int64_t prev_score = Score(D);
  constexpr int64_t kIgnoreBunbo = 5;
  constexpr int64_t kIgnoreBunshi = 0;
  constexpr int64_t kMaxConsecutiveWorse = 3;

  vector<int64_t> best_contests;
  int64_t best_score = INT64_MIN;
  int64_t consecutive_worse = 0;
  vector<int64_t> better_contests;
  for (int64_t i = 0; i < 130000; ++i) {
    const int64_t day_candidate_1 = (rand() % D) + 1;
    const int64_t day_candidate_2 = (rand() % D) + 1;
    const int64_t original_contest = contests[day_candidate_1];
    const int64_t contest_candidate = (rand() % kN) + 1;
    if (day_candidate_1 == day_candidate_2) {
      contests[day_candidate_1] = contest_candidate;
    } else {
      swap(contests[day_candidate_1], contests[day_candidate_2]);
    }
    const int64_t temp_score = Score(D);
    if (temp_score > prev_score) {
      // KEEP
      consecutive_worse = 0;
      better_contests = contests;
      if (temp_score > best_score) {
        best_score = temp_score;
        best_contests = contests;
      }
    } else if ((rand() % kIgnoreBunbo) <= kIgnoreBunshi && temp_score > prev_score * 0.97 &&
               consecutive_worse <= kMaxConsecutiveWorse) {
      // KEEP
      ++consecutive_worse;
    } else {
      if (day_candidate_1 == day_candidate_2) {
        contests[day_candidate_1] = original_contest;
      } else {
        swap(contests[day_candidate_1], contests[day_candidate_2]);
      }
    }
    if (temp_score < best_score * 0.9) {
      contests = best_contests;
    }
  }

  contests = best_contests;
  OutputResults();
  return 0;
}


Measured memory_bytes: 3848