#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

struct Output {
private:
	vector<ll> contestList;
	
public:
	
	
};


class Input {
	vector<ll> decreaseRates;
	vector<vector<ll>> satisfactions;
	ll numContests = 26;
	ll numDay = 365;
	vector<ll> contestList;
	vector<ll> lastContestDay;
	vector<set<ll>> holdDays;
	ll m_score;

public:
	void initialize() {
		contestList.resize(numDay + 1);
		lastContestDay.resize(numContests + 1);
		holdDays.resize(numContests + 1);
	}
	void initializeLastContest() {
		lastContestDay.clear();
		lastContestDay.resize(numContests + 1);
	}
	void readInputs() {
		decreaseRates.resize(numContests + 1);
		for (ll i = 1; i <= numContests; i++) {
			cin >> decreaseRates[i];
		}
		satisfactions.resize(numDay + 1);
		for (ll i = 1; i <= numDay; i++) {
			satisfactions[i].resize(numContests + 1);
			for (ll j = 1; j <= numContests; j++) {
				cin >> satisfactions[i][j];
			}
		}
	}

	ll getNumContests() { return numContests; }
	ll getNumDay() { return numDay; }
	ll getScore() { return m_score; }
	vector<ll> getDecreaseRates() { return decreaseRates; }
	vector<vector<ll>> getSatisfactions() { return satisfactions; }
	ll getContest(ll day) {
		return contestList[day];
	}
	vector<ll> getContestList() { return contestList; }
	void setNumContests(ll num) { numContests = num; }
	void setNumDay(ll day) { numDay = day; }
	void setContest(ll day, ll contest, bool updateScore = false) {
		if (contestList[day] != 0) {
			ll pre = contestList[day];
			if (updateScore) {
				ll prevDay = 0;
				ll nextDay = INT64_MAX;
				auto itr = holdDays[pre].find(day);
				if (itr != holdDays[pre].begin()) {
					auto prevItr = --itr;
					prevDay = *prevItr;
					itr++;
				}
				auto nextItr = ++itr;
				if (nextItr != holdDays[pre].end()) {
					nextDay = *nextItr;
				}
				m_score -= (min(nextDay, numDay + 1) - day) * (day - prevDay) * decreaseRates[pre];
				m_score -= satisfactions[day][pre];
			}
			holdDays[pre].erase(day);
		}
		contestList[day] = contest;
		
		holdDays[contest].insert(day);
		if (updateScore) {
			ll prevDay = 0;
			ll nextDay = INT64_MAX;
			auto itr = holdDays[contest].find(day);
			if (itr != holdDays[contest].begin()) {
				auto prevItr = --itr;
				prevDay = *prevItr;
				itr++;
			}
			
			auto nextItr = ++itr;
			if (nextItr != holdDays[contest].end()) {
				nextDay = *nextItr;
			}
			m_score += (min(nextDay, numDay + 1) - day) * (day - prevDay) * decreaseRates[contest];
			m_score += satisfactions[day][contest];
		}
		
	}

	

	ll calcScore() {
		ll score = 0;
		initializeLastContest();

		for (ll day = 1; day <= numDay; day++) {
			ll dayContest = contestList[day];
			lastContestDay[dayContest] = day;
			score += satisfactions[day][dayContest];
			for (ll contest = 1; contest <= numContests; contest++) {
				score -= decreaseRates[contest] * (day - lastContestDay[contest]);
			}
		}
		m_score = score;
		return score;
	}

};


ll mod26(ll num) {
	if (num % 26 == 0) {
		return 26;
	}
	return num % 26;
}

int main() {
	ll numDay;
	cin >> numDay;

	Input input;
	input.setNumDay(numDay);
	input.initialize();
	input.readInputs();
	for (ll i = 1; i <= numDay; i++) {
		input.setContest(i, mod26(i));
	}
	for (ll i = 1; i <= numDay; i++) {
		cout << input.getContest(i) << endl;
	}

}


Measured memory_bytes: 3744