#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>
#include <random>

struct ContestSpan {
	int i, c, prev, next;
	int penalty() const {
		return c * (next - prev - 2) * (next - prev - 1) >> 1;
	}
	bool operator<(const ContestSpan& that) const {
		return penalty() < that.penalty();
	}
};
int main() {
	int d; std::cin >> d;
	std::vector<int> c(26); for (auto& ci : c) std::cin >> ci;
	std::vector<std::vector<int>> s(d, std::vector<int>(26));
	for (auto& line : s) {
		for (auto& si : line) std::cin >> si;
	}
	std::vector<std::vector<int>> rank(d, std::vector<int>(26));
	std::vector<int> contest(d);
	std::priority_queue<ContestSpan> queue;
	std::vector<std::set<int>> days(26, std::set<int>{-1});
	for (auto i = 0; i < d; ++i) {
		std::vector<int> indices(26); std::iota(indices.begin(), indices.end(), 0);
		std::sort(indices.rbegin(), indices.rend(), [&s, i](const int a, const int b) {return s[i][a] < s[i][b]; });
		for (auto j = 0; j < indices.size(); ++j) {
			rank[i][indices[j]] = j;
		}
		contest[i] = indices[0];
		queue.push(ContestSpan{ indices[0], c[indices[0]], *days[indices[0]].rbegin(), i });
		days[indices[0]].insert(i);
	}
	for (auto i = 0; i < 26; ++i) {
		queue.push(ContestSpan{ i, c[i], *days[i].rbegin(), d });
		days[i].insert(d);
	}

	while (!queue.empty()) {
		const auto span = queue.top(); queue.pop();
		const auto penalty = span.penalty();
		const auto day = span.next - span.prev;
		int suspect = -1;
		int gain = 0;
		for (auto mid = std::max(0, span.prev); mid < span.next; ++mid) {
			const auto current_contest = contest[mid];
			const auto new_next = *days[current_contest].lower_bound(mid);
			const auto new_prev = *std::prev(days[current_contest].lower_bound(mid));
			const auto new_span = ContestSpan{ current_contest, c[current_contest], new_prev, new_next };
			const auto prev = ContestSpan{ span.i, span.c, span.prev, mid };
			const auto next = ContestSpan{ span.i, span.c, mid, span.next };
			const auto new_pen = prev.penalty() + next.penalty() + new_span.penalty();
			const auto current_sat = s[mid][current_contest];
			const auto new_sat = s[mid][span.i];
			if (new_sat - new_pen - current_sat + penalty > gain) {
				suspect = mid;
				gain = new_sat - new_pen - current_sat + penalty;
			}
		}
		if (suspect < 0) continue;
		const auto current_contest = contest[suspect];
		const auto new_next = *days[current_contest].lower_bound(suspect);
		const auto new_prev = *std::prev(days[current_contest].lower_bound(suspect));
		const auto new_span = ContestSpan{ current_contest, c[current_contest], new_prev, new_next };
		const auto prev = ContestSpan{ span.i, span.c, span.prev, suspect };
		const auto next = ContestSpan{ span.i, span.c, suspect, span.next };
		contest[suspect] = span.i;
		queue.push(new_span); queue.push(prev); queue.push(next);
	}
	for (const auto i : contest) {
		std::cout << i + 1 << '\n';
	}
}

Measured memory_bytes: 3756