#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion

//#define test

const int CONTEST_NUM = 26;
const int D = 365;
int pena[CONTEST_NUM];
int sati[D][CONTEST_NUM];

void input() {
    int _;
    cin >> _;
    rep(i, CONTEST_NUM) cin >> pena[i];
    rep(d, D) rep(i, CONTEST_NUM) cin >> sati[d][i];
}

unsigned int xor128() {
    static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
    unsigned long t;
    t = (x ^ (x << 11));
    x=y;
    y=z;
    z=w;
    return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

using Move = int;

class State {
public:
    State() {
        rep(i, D) plan[i] = -1;
        rep(i, CONTEST_NUM) last[i] = -1;
        score = 0.0;
        day = 0;
        //init_by_greedy();
    };

    vector<Move> enum_move() const {
        vector<Move> ms(CONTEST_NUM);
        iota(ms.begin(), ms.end(), 0);
        return ms;
    }

    int try_move(Move m) const {
        const int K = 7;
        int diff = sati[day][m];
        //rep(i, CONTEST_NUM) diff -= pena[i] * (day - last[i]);
        rep(d, K) {
            rep(i, CONTEST_NUM) {
                if (i == m) diff -= pena[i] * (day + d - day);
                else diff -= pena[i] * (day + d - last[i]);
            }
        }
        //diff += pena[m] * (day - last[m]);
        return score + diff;
    }

    State new_state(const Move &m, int _/*new_score*/) const {
        State ns = *this;
        ns.plan[day] = m;
        ns.last[m] = day;
        ns.score = score;
        ns.score += sati[day][m];
        rep(i, CONTEST_NUM) ns.score -= pena[i] * (day - ns.last[i]);
        ns.day++;
        return ns;
    }

    void write_solution() const {
        rep(d, D) printf("%d\n", plan[d] + 1);
    }

    void _write_solution() const {
        rep(d, D) fprintf(stderr, "%d ", plan[d] + 1);
        cerr << endl;
    }

    int score;

private:
    array<int, D> plan;

    array<int, CONTEST_NUM> last;


    int day;

    void init_by_greedy() {
        vector<int> last(CONTEST_NUM, -1);
        int best_diff = -1e9, best_kind = -1;
        rep(d, D) {
            rep(i, CONTEST_NUM) {
                int diff = sati[d][i] + pena[i] * (d - last[i]);
                if (chmax(best_diff, diff)) best_kind = i;
            }
            plan[d] = best_kind;
            last[best_kind] = d;
        }
    }
};

State beam_search() {
    const int BEAM_WIDTH = 800;

    vector<State> states(1);

    using T = tuple<int, State*, Move>;

    rep(t, D) {

#ifdef test
        cerr << "turn: " << t << endl;
        cerr << states.size() << endl;
#endif

        vector<T> cands;
        rep(i, states.size()) {
            auto ms = states[i].enum_move();
            for (const Move &m: ms) {
                cands.push_back(make_tuple(states[i].try_move(m), &states[i], m));
            }
        }

        //shuffle(cands.begin(), cands.end(), rnd);
        sort(cands.rbegin(), cands.rend(), [](const T &a, const T &b){ return get<0>(a) < get<0>(b); });

        int cs = min((int)cands.size(), BEAM_WIDTH);
        vector<State> new_states(cs);
        rep(i, cs) {
            ll new_score = get<0>(cands[i]);
            const State *s = get<1>(cands[i]);
            const Move &m = get<2>(cands[i]);
            new_states[i] = s->new_state(m, new_score);
        }

        states = new_states;
    }

    /*int num = 0;
    for (const State &s: states) {
        cerr << num++ << endl;
        s._write_solution();
    }*/

    return states[0];
}


int main() {
    input();

    State s = beam_search();

    cerr << s.score << endl;
    s.write_solution();
}

Measured memory_bytes: 8000