#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 - 1) * (next - prev)) >> 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);
	}
	for (auto temp = 365; temp >= 0; --temp) {
		std::vector<bool> is_changed(365, false);
		std::vector<ContestSpan> stock;
		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 = span.prev + 1; 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];
				const auto new_gain = new_sat - new_pen - current_sat + penalty + (is_changed[mid] ? 0 : temp << 3);
				if (new_sat - new_pen - current_sat + penalty > gain) {
					suspect = mid;
					gain = new_sat - new_pen - current_sat + penalty;
				}
			}
			if (suspect < 0) {
				stock.push_back(span);
				continue;
			}
			is_changed[suspect] = true;
			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& st : stock) queue.push(st);
	}
	for (const auto i : contest) {
		std::cout << i + 1 << '\n';
	}
}

Measured memory_bytes: 3784