#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

template <class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int D;
VI c(26);
VVI s;
VI t;
VI best;
ll sc;
set<int> days[26];
VI partsc;
multiset<P> pss;

const double TIME_LIMIT = 1.8;
clock_t time_start;

inline uint32_t rnd(void) {
    static uint32_t y = 2463534242;
    y = y ^ (y << 13);
    y = y ^ (y >> 17);
    return y = y ^ (y << 5);
}

void read_input() {
    cin >> D;
    for (int i = 0; i < 26; i++) cin >> c[i];
    s = VVI(D, VI(26));
    for (int i = 0; i < D; i++) {
        for (int j = 0; j < 26; j++) cin >> s[i][j];
    }
}

void init() {
    for (int i = 0; i < 26; i++) days[i].insert(-1);
    for (int i = 0; i < D; i++) {
        days[t[i]].insert(i);
    }
    for (int i = 0; i < 26; i++) days[i].insert(D);
    partsc = VI(D);
    for (int i = 0; i < D; i++) {
        auto it = days[t[i]].find(i);
        int nxt = *++it;
        --it;
        int prev = *--it;
        partsc[i] = s[i][t[i]] + (nxt - prev) * (nxt - prev - 1) / 2 - (nxt - i) * (nxt - i - 1) / 2 -
                    (i - prev) * (i - prev - 1) / 2;
    }
}

void init_by_input() {
    t = VI(D);
    for (int i = 0; i < D; i++) {
        cin >> t[i];
        t[i]--;
    }
    for (int i = 0; i < 26; i++) days[i].insert(-1);
    for (int i = 0; i < D; i++) {
        days[t[i]].insert(i);
    }
    for (int i = 0; i < 26; i++) days[i].insert(D);
}

void init_by_greedy() {
    t = VI(D);
    ll sum_sc = 0;
    set<int> se[26];
    for (int i = 0; i < 26; i++) se[i].insert(-1);
    for (int i = 0; i < D; i++) {
        ll dif = 0;
        for (int j = 0; j < 26; j++) {
            dif -= c[j] * (i - *se[j].rbegin());
        }
        sum_sc += dif;
        ll dm = -inf;
        int fl = -1;
        for (int j = 0; j < 26; j++) {
            if (chmax(dm, s[i][j] + c[j] * (i - *se[j].rbegin()))) fl = j;
        }
        t[i] = fl;
        se[fl].insert(i);
    }
}

ll calc_score() {
    ll plus = 0;
    ll minus = 0;
    for (int i = 0; i < D; i++) {
        plus += s[i][t[i]];
    }
    for (int i = 0; i < 26; i++) {
        for (auto it = ++days[i].begin(); it != days[i].end(); ++it) {
            int lapse = *it - (*--it);
            minus += c[i] * lapse * (lapse - 1) / 2;
            ++it;
        }
    }
    return plus - minus;
}

void output() {
    for (int i = 0; i < D; i++) {
        cout << t[i] + 1 << endl;
    }
}

ll r(ll y) { return y * (y - 1) / 2; }

void mountain() {
    int u = rnd() % (D - 1);
    int v = u + 1;
    if (t[u] == t[v]) return;
    auto it1 = days[t[u]].find(u);
    int pgap1 = u - *--it1;
    ++it1;
    int ngap1 = *++it1 - u;
    auto it2 = days[t[v]].find(v);
    int pgap2 = v - *--it2;
    ++it2;
    int ngap2 = *++it2 - v;
    ll dif = 0;
    dif += s[v][t[u]] - s[u][t[u]] - r(pgap1 + 1) + r(pgap1) - r(ngap1 - 1) + r(ngap1);
    dif += s[u][t[v]] - s[v][t[v]] - r(pgap2 - 1) + r(pgap2) - r(ngap2 + 1) + r(ngap2);
    if (dif >= 0) {
        swap(t[u], t[v]);
    }
}

void outinsert(){
    P mini = *pss.begin();
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    time_start = clock();
    read_input();
    // init_by_input();
    init_by_greedy();
    init();
    //cout << calc_score() << endl;
    while ((double)(clock() - time_start) / CLOCKS_PER_SEC < TIME_LIMIT) {
        mountain();
    }

    output();
    //cout << calc_score() << endl;
}


Measured memory_bytes: 3728