#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

const long long INF = 1e18;
//const ll mod = 1000000007;
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<> test(0, 364);
uniform_real_distribution<> prob(0.0, 1.0);
uniform_int_distribution<> target(0, 25);
uniform_int_distribution<> way(0, 2);

ll deltasum = 0;

struct Master {
    const int D = 365;
    const int N = 26;
    int c[26];
    int s[365][26];
    int ans[365];
    set<int> st[26];
    void input() {
        int dust;
        cin >> dust;
        for(int i = 0; i < N; i++) cin >> c[i];
        for(int i = 0; i < D; i++) {
            for(int j = 0; j < N; j++) {
                cin >> s[i][j];
            }
        }
    }
    int f(int x) {
        return x * (x - 1) / 2;
    }
    void improve(double temp) {
        int A = way(mt);
        int t = target(mt);
        int day = test(mt);
        const int from = ans[day];
        while(t == from) t = target(mt);
        int delta = -1e9;
        int nxt = from;
        auto tmp = intervals(from, day);
        int basedelta = 0;
        basedelta += f(tmp.first) * c[from];
        basedelta += f(tmp.second) * c[from];
        basedelta -= f(tmp.first+tmp.second) * c[from];
        basedelta -= s[day][from];
        for(int i = 0; i < N; i++) {
            if(A != 0) break;
            i = t;
            if(ans[day] == i) continue;
            auto tmp = intervals(i, day);
            int additional = 0;
            additional += f(tmp.first+tmp.second) * c[i];
            additional -= f(tmp.first) * c[i];
            additional -= f(tmp.second) * c[i];
            additional += s[day][i];
            if(chmax(delta, basedelta + additional)) {
                nxt = i;
            }
            break;
        }
        if(A == 1 and day > 0 and ans[day] != ans[day-1]) {
            int nowdelta = exchangefollowingday(day-1);
            if(chmax(delta, nowdelta)) {
                nxt = -2;
            }
        }
        if(A == 2 and day+1<D and ans[day] != ans[day+1]) {
            int nowdelta = exchangefollowingday(day);
            if(chmax(delta, nowdelta)) {
                nxt = -1;
            }
        }
        if(nxt == from) return;
        temp *= 8000;
        double border = exp(delta / temp);
        //if(delta < 0) cerr << border << endl;
        if(prob(mt) > border) return;
        //if(delta < 0) cerr << "updated!: " << day << " " << from << " " << nxt << " " << delta << endl;
        //cerr << "updated!: " << temp << " " << delta << endl;
        deltasum += delta;
        if(nxt == -1) {
            int to = ans[day+1];
            query(day, to);
            query(day+1, from);
        } else if(nxt == -2) {
            int to = ans[day-1];
            query(day, to);
            query(day-1, from);
        } else {
            query(day, nxt);
        }
    }
    int exchangefollowingday(int day) {
        int from = ans[day];
        int to = ans[day+1];
        auto tmpfrom = intervals(from, day);
        auto tmpto = intervals(to, day + 1);
        int delta = 0;
        delta += f(tmpfrom.first) * c[from];
        delta += f(tmpfrom.second) * c[from];
        delta -= f(tmpfrom.first+1) * c[from];
        delta -= f(tmpfrom.second-1) * c[from];
        delta -= s[day][from];
        delta += s[day+1][from];
        delta += f(tmpto.first) * c[to];
        delta += f(tmpto.second) * c[to];
        delta -= f(tmpto.first-1) * c[to];
        delta -= f(tmpto.second+1) * c[to];
        delta -= s[day+1][to];
        delta += s[day][to];
        return delta;
    }
    i_i intervals(int idx, int day) {
        auto itr = st[idx].upper_bound(day);
        i_i ret;
        ret.second = *itr - day;
        itr--;
        if(*itr == day) itr--;
        ret.first = day - *itr;
        return ret;
    }
    void initialize() {
        vector<double> v;
        double sum = 0;
        for(int i = 0; i < N; i++) {
            double tmp = pow(c[i], 1.1);
            v.push_back(tmp);
            sum += tmp;
            st[i].insert(-1);
            st[i].insert(D);
        }
        uniform_real_distribution<double> test(0.0, sum);
        for(int i = 0; i < D; i++) {
            ans[i] = 0;
            double val = test(mt);
            for(int j = 0; j < v.size(); j++) {
                val -= v[j];
                if(val < 0) {
                    ans[i] = j;
                    st[j].insert(i);
                    break;
                }
            }
        }
        /*
        int num = 0;
        for(int i = 0; i < N; i++) {
            num += st[i].size() - 2;
        }
        assert(num == D);
        */
    }
    void query(int day, int nxt) {
        int from = ans[day];
        st[from].erase(day);
        st[nxt].insert(day);
        ans[day] = nxt;
    }
    void print() {
        for(int i = 0; i < D; i++) {
            cout << ans[i] + 1 << "\n";
        }
    }
    int calc() {
        int Last[26];
        for(int i = 0; i < 26; i++) Last[i] = -1;
        int ansval = 0;
        for(int i = 0; i < D; i++) {
            ansval += s[i][ans[i]];
            Last[ans[i]] = i;
            for(int j = 0; j < N; j++) {
                ansval -= c[j] * (i - Last[j]);
            }
        }
        return ansval;
    }
};

const int TL = 1980;

int main() {
    auto start = std::chrono::system_clock::now();
    Master master;
    master.input();
    master.initialize();
    //int initialscore = master.calc();
    //master.print();
    while(true) {
        auto nowtimer = std::chrono::system_clock::now();
        auto dur = nowtimer - start;
        auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(dur).count();
        if(msec >= TL) break;
        master.improve((double)(TL - msec) / TL);
    }
    //cerr << "-----------------------" << endl;
    //master.print();
    //cerr << initialscore << " " << master.calc() << " " << deltasum << endl;
    //assert(master.calc() == initialscore + deltasum);
    master.print();
    cerr << master.calc() << endl;
    return 0;
}

Measured memory_bytes: 4380