// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

// [lb, ub] の閉区間内の値をランダムに返す構造体
// #include <random> しよう

struct Rand {
public:
    Rand() = default;
    Rand(std::mt19937::result_type seed) : eng(seed) {}
    int NextInt(int lb, int ub) {
        return std::uniform_int_distribution<int>{lb, ub}(eng);
    }
    ll NextLong(ll lb, ll ub) {
        return std::uniform_int_distribution<ll>{lb, ub}(eng);
    }
    double NextDouble(double lb, double ub) {
        return std::uniform_real_distribution<double>{lb, ub}(eng);
    }
private:
    std::mt19937 eng{std::random_device{}()};
};

/* 
// example.
int main() {
    Rand rnd(114514);
    int l, r; scanf("%d%d", &l, &r);
    printf("l = %d, r = %d, value = %d\n", l, r, rnd.NextInt(l, r));

    double L, R; scanf("%lf%lf", &L, &R);
    printf("L = %.12f, R = %.12f, value = %.12f\n", L, R, rnd.NextDouble(L, R));

    long long int a, b; scanf("%lld%lld", &a, &b);
    printf("a = %lld, b = %lld, value = %lld\n", a, b, rnd.NextLong(a, b));
    return 0;
}
*/

class Timer {
    chrono::high_resolution_clock::time_point start, end;
    double limit;

public:
    Timer() {
        start = chrono::high_resolution_clock::now();
    }
    Timer(double l) {
        start = chrono::high_resolution_clock::now();
        limit = l;
    }

    double getTime() {
        end = chrono::high_resolution_clock::now();
        return chrono::duration<double>(end - start).count();
    }

    bool isTimeOver() {
        if (getTime() > limit) {
            return true;
        }
        return false;
    }

    double getLimit() { return limit; }
    void setLimit(double l) {
        limit = l;
    }
    void setStart() { start = chrono::high_resolution_clock::now(); }
};

const int DAY = 365;
const int CONT = 26;
Rand rnd(1333);

struct Solver {
    int D, C[CONT], S[DAY][CONT], ans[DAY], best_ans[DAY];
    ll score, best_score, update_iter;
    set<int> schedules[CONT];

    Solver() {
        update_iter = 0;
        fill(ans, ans + DAY, -1);
    }
    
    void read_input() {
        scanf("%d", &D);
        for(int i=0; i<CONT; i++) {
            scanf("%d", &C[i]);
        }
        for(int i=0; i<D; i++) {
            for(int j=0; j<CONT; j++) {
                scanf("%d", &S[i][j]);
            }
        }

        for(int i=0; i<CONT; i++) {
            schedules[i].emplace(-1);
            schedules[i].emplace(D);
        }
    }

    void set_random() {
        for(int i=0; i<D; i++) {
            ans[i] = rnd.NextInt(1, CONT) - 1;
            schedules[ ans[i] ].emplace(i);
            best_ans[i] = ans[i];
        }
    }

    ll calc_score(bool store=true) {
        ll res = 0;
        int last[CONT] = {};
        for(int i=0; i<D; i++) {
            res += S[i][ ans[i] ];
            last[ ans[i] ] = i+1;
            for(int j=0; j<CONT; j++) {
                res -= C[j] * (i+1 - last[j]);
            }
        }
        if(store) score = res;
        return res;
    }

    void update(int day, int contest) {
        int pre_contest = ans[day];
        ans[day] = contest;

        // 削除
        {
            score -= S[day][pre_contest];
            // assert(schedules[pre_contest].count(day));
            auto ptr = schedules[pre_contest].lower_bound(day);
            ll d0 = day - *prev(ptr);
            ll d1 = *next(ptr) - *prev(ptr);
            ll d2 = *next(ptr) - day;
            score += d0 * (d0 - 1) / 2 * C[pre_contest];
            score -= d1 * (d1 - 1) / 2 * C[pre_contest];
            score += d2 * (d2 - 1) / 2 * C[pre_contest];
            schedules[pre_contest].erase(day);
        }
        // 追加
        {
            score += S[day][contest];
            // assert(!schedules[contest].count(day));
            schedules[contest].emplace(day);
            auto ptr = schedules[contest].lower_bound(day);
            ll d0 = day - *prev(ptr);
            ll d1 = *next(ptr) - *prev(ptr);
            ll d2 = *next(ptr) - day;
            score -= d0 * (d0 - 1) / 2 * C[contest];
            score += d1 * (d1 - 1) / 2 * C[contest];
            score -= d2 * (d2 - 1) / 2 * C[contest];
        }
    }

    bool update_best_ans() {
        if(best_score >= score) return false;

        update_iter = 0;
        best_score = score;
        for(int i=0; i<D; i++) best_ans[i] = ans[i];
        return true;
    }

    void proceed() {
        int d = rnd.NextInt(1, D) - 1;
        int q = rnd.NextInt(1, CONT) - 1;

        int prev_ans = ans[d];
        update(d, q);
        if(!update_best_ans()) update(d, prev_ans);
    }
};

int main() {
    Solver solver;
    solver.read_input();

    /*
    for(int i=0; i<solver.D; i++) {
        int t; scanf("%d", &t);
        solver.ans[i] = --t;
        solver.schedules[t].emplace(i);
    }
    solver.calc_score();
    */

    /*
    int Q; scanf("%d", &Q);
    while(Q--) {
        int d, q; scanf("%d%d", &d, &q);
        d--; q--;
        solver.update(d, q);
        printf("%lld\n", solver.score);
    }
    */

    Timer timer;
    solver.set_random();
    ll init_score = solver.calc_score(), iter = 0;
    solver.best_score = solver.score;
    fprintf(stderr, "init_score = %lld\n", init_score);
    for(; ; iter++) {
        if(iter % 1000 == 0) {
            if(timer.getTime() > 1.9) break;
        }
        solver.proceed();
    }

    ll final_score = solver.best_score;
    fprintf(stderr, "final_score = %lld\n", final_score);
    fprintf(stderr, "iter = %lld, update_iter = %lld\n", iter, solver.update_iter);
    for(int i=0; i<solver.D; i++) {
        printf("%d\n", solver.best_ans[i] + 1);
    }
    return 0;
}


Measured memory_bytes: 3852