#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));
}

enum TransType { SWAP, CHANGE };

class State {
public:
    State() {
        //rep(i, D) plan[i] = i % CONTEST_NUM;

        init_by_greedy();
    };

    void next() {
        if (xor128() & 1) {
            day1 = xor128() % D;
            day2 = xor128() % D;
            swap(plan[day1], plan[day2]);
            trty = SWAP;
        }
        else {
            day = xor128() % D;
            pre_kind = plan[day];
            plan[day] = xor128() % CONTEST_NUM;
            trty = CHANGE;
        }
    }

    void prev() {
        if (trty == SWAP) {
            swap(plan[day1], plan[day2]);
        }
        else {
            plan[day] = pre_kind;
        }
    }

    double energy() {
        double score = 0;
        rep(d, D) score += sati[d][plan[d]];
        vector<int> last(CONTEST_NUM, -1);
        rep(d, D) {
            last[plan[d]] = d;

            rep(i, CONTEST_NUM) {
                score -= pena[i] * (d - last[i]);
            }
        }

        return -score;
    }

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

private:
    array<int, D> plan;

    TransType trty;

    // スワップした日
    int day1, day2;

    // 変更した日、元の種類
    int day, pre_kind;

    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;
        }
    }
};

double elapsed_time(chrono::system_clock::time_point start, chrono::system_clock::time_point end) {
    return static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000);
}

struct SimulatedAnnealing {
public:
    SimulatedAnnealing() {}

    State run() {
        const auto time_start = chrono::system_clock::now();
        const auto time_end = time_start + chrono::milliseconds(TIME_LIMIT);
        State state;
        double energy = state.energy();

        double min_energy = energy;
        int counter = 0;
        auto time_current = time_start;
        uniform_real_distribution<double> dist(0.0, 1.0);

        while ((time_current = chrono::system_clock::now()) < time_end) {
            state.next();
            double energy_neighbor = state.energy();
            double random = xor128() * 0.00000000023283064365386962890625;
            double probability = calculate_probability(energy,
                energy_neighbor,
                elapsed_time(time_current, time_end) / (elapsed_time(time_start, time_end) + 1e-15));

            if (random < probability) {
                if (min_energy > energy_neighbor) {
#ifdef test
                fprintf(stderr, "update min_energy %lf -> %lf %lf\n", min_energy, energy_neighbor, elapsed_time(time_start, time_current));
                fprintf(stderr, "%lf %lf\n", elapsed_time(time_start, time_current), energy_neighbor);
#endif
                    min_energy = energy_neighbor;
                }
                energy = energy_neighbor;
            }
            else {
                state.prev();
            }
            counter++;
        }

        fprintf(stderr, "counter: %d min_energy: %lf\n", counter, min_energy);
        return state;
    }
private:
    //ミリ秒単位
    const int TIME_LIMIT = 1950;

    //遷移確率
    double calculate_probability(double energy, double energy_neighbor, double temp) const {
        if (energy_neighbor < energy) return 1;
        else return 0.0;
        // double res = exp((energy - energy_neighbor) * 0.5) * temp;
        // return res;
    }
};

int main() {
    input();

    SimulatedAnnealing sa;
    State state = sa.run();
    state.write_solution();
}

Measured memory_bytes: 3832