#define NDEBUG
#include <vector>
#include <set>
#include <sys/time.h>
#include <unistd.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>

namespace mm {
    inline void getCpuClock(unsigned long long & t) {
        __asm__ __volatile__ ("rdtsc" : "=a"(*(unsigned int*)&t), "=d"(((unsigned int*)&t)[1]));
    }

    inline double getNativeTime() {
        timeval tv;
        gettimeofday(&tv, 0);
        return tv.tv_sec + tv.tv_usec * 1e-6;
    }

    unsigned long long g_initCpuClock;
    unsigned long long g_reserveUpdateCpuClock;
    double g_initNativeTime;
    double g_secPerClock;
    double g_doneTime;
    inline void initTime() {
        g_initNativeTime = getNativeTime();
        getCpuClock(g_initCpuClock);
        g_secPerClock = 0.00000000025;
        g_reserveUpdateCpuClock = 10000000;
        g_doneTime = 0;
    }

    inline double getTime() {
        unsigned long long now;
        getCpuClock(now);
        now -= g_initCpuClock;
        if(g_reserveUpdateCpuClock < now) {
            double nowTime = getNativeTime() - g_initNativeTime;
            g_secPerClock = nowTime / now;
            g_reserveUpdateCpuClock = now + (unsigned long long)(0.05 * now / nowTime);
        }
        return g_doneTime = std::fmax(g_doneTime, g_secPerClock * now);
    }
}

namespace mm {
    inline unsigned int asm_mul_hi(unsigned int x, unsigned int y) {
        __asm__ __volatile__("mul %%edx" : "+a"(x), "+d"(y));
        return y;
    }
    unsigned long long g_rand49_state = 0x8a5cd789635d2dffULL;
    inline int mrand49() {
        g_rand49_state *= 6364136223846793005ULL;
        g_rand49_state += 1442695040888963407ULL;
        unsigned int ret = ((g_rand49_state>>18)^g_rand49_state) >> 27;
        unsigned int rot = (g_rand49_state>>59);
        return (ret>>rot) | (ret<<-rot);
    }
    inline long long mmrand49() {
        int v = mrand49();
        return ((long long)v << 32) | mrand49();
    }
    inline int lrand49() {
        return mrand49() & 0x7FFFFFFF;
    }
    inline int lrand49(int r) {
        assert(1<=r);
        return asm_mul_hi(mrand49(), r);
        //return ((unsigned long long)(unsigned int)mrand49() * r)>>32;
    }

    inline double drand49() {
        return ((unsigned int)mrand49() + 0.5) * (1.0/4294967296.0);
    }

    inline void srand49(int seed) {
        g_rand49_state = seed + 1442695040888963407ULL;
    }
    inline void srand49() {
        int clk;
        __asm__ __volatile__ ("rdtsc" : "=a"(*(unsigned int*)&clk) : : "%rdx");
        srand49(clk);
    }
}

using namespace std;
using namespace mm;

#define arraysizeof(a) (sizeof(a)/sizeof(a[0]))
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
constexpr int I = 26;
constexpr double limit = 1.95;
int D;
int c[I];
int s[365][I];
int t[365];
int cnt;
double rnd[8192];
double Tr;
double T;
set<int> days[I];

bool accept(int dSc) {
    if(0<=dSc) return true;
    return T * rnd[cnt&(arraysizeof(rnd)-1)] < dSc;
}

int pena(int dd) {
    return (dd * (dd+1)) >> 1;
}

int score(int i, int d) {
    auto it = days[i].lower_bound(d);
    int nd = D;
    if(it!=days[i].end()) {
        nd = *it;
    }
    int pd = 0;
    if(it!=days[i].begin()) {
        --it;
        pd = *it;
    }
    return s[d][i] - (pena(nd-d) + pena(d-pd) - pena(nd-pd)) * c[i];
}

void mutateA() {
    int d = lrand49(D);
    int i1 = t[d];
    int i2 = lrand49(I-1);
    if(i1<=i2) ++i2;
    days[i1].erase(d);
    int dSc = score(i2, d) - score(i1, d);
    if(accept(dSc)) {
        days[i2].insert(d);
        t[d] = i2;
    }
    else {
        days[i1].insert(d);
    }
}

void mutateB() {
    int dd = lrand49(14) + 1;
    int d1 = lrand49(D-dd);
    int d2 = d1 + dd;
    int i1 = t[d1];
    int i2 = t[d2];
    if(i1==i2) return;
    days[i1].erase(d1);
    days[i2].erase(d2);
    int dSc = score(i1, d2) + score(i2, d1) - score(i1, d1) - score(i2, d2);
    if(accept(dSc)) {
        days[i1].insert(d2);
        days[i2].insert(d1);
        t[d1] = i2;
        t[d2] = i1;
    }
    else {
        days[i1].insert(d1);
        days[i2].insert(d2);
    }
}

void mutateC() {
    int dd = lrand49(14) + 1;
    int dd2 = lrand49(14);
    if(dd<=dd2) {
        ++dd2;
    }
    else {
        swap(dd, dd2);
    }
    int d1 = lrand49(D-dd2);
    int d2 = d1 + dd;
    int d3 = d1 + dd2;
    int i1 = t[d1];
    int i2 = t[d2];
    int i3 = t[d3];
    if(i1==i2 || i2==i3 || i1==i3) {
        return;
    }
    days[i1].erase(d1);
    days[i2].erase(d2);
    days[i3].erase(d3);
    int sc11 = score(i1, d1);
    int sc12 = score(i1, d2);
    int sc13 = score(i1, d3);
    int sc21 = score(i2, d1);
    int sc22 = score(i2, d2);
    int sc23 = score(i2, d3);
    int sc31 = score(i3, d1);
    int sc32 = score(i3, d2);
    int sc33 = score(i3, d3);
    int sc123 = sc11 + sc22 + sc33;
    int sc132 = sc11 + sc23 + sc32;
    int sc213 = sc12 + sc21 + sc33;
    int sc231 = sc12 + sc23 + sc31;
    int sc312 = sc13 + sc21 + sc32;
    int sc321 = sc13 + sc22 + sc31;
    int max_sc = max(max(max(sc123, sc132), max(sc213, sc231)), max(sc312, sc321));
    sc123 -= max_sc;
    sc132 -= max_sc;
    sc213 -= max_sc;
    sc231 -= max_sc;
    sc312 -= max_sc;
    sc321 -= max_sc;
    double p123 = exp(sc123 / T);
    double p132 = exp(sc132 / T);
    double p213 = exp(sc213 / T);
    double p231 = exp(sc231 / T);
    double p312 = exp(sc312 / T);
    double p321 = exp(sc321 / T);
    double sum = p123 + p132 + p213 + p231 + p312 + p321;
    double r = drand49() * sum;
    if(r<p123) {
        days[i1].insert(d1);
        days[i2].insert(d2);
        days[i3].insert(d3);
        return;
    }
    p132 += p123;
    if(r<p132) {
        days[i1].insert(d1);
        days[i2].insert(d3);
        days[i3].insert(d2);
        t[d3] = i2;
        t[d2] = i3;
        return;
    }
    p213 += p132;
    if(r<p213) {
        days[i1].insert(d2);
        days[i2].insert(d1);
        days[i3].insert(d3);
        t[d2] = i1;
        t[d1] = i2;
        return;
    }
    p231 += p213;
    if(r<p231) {
        days[i1].insert(d2);
        days[i2].insert(d3);
        days[i3].insert(d1);
        t[d2] = i1;
        t[d3] = i2;
        t[d1] = i3;
        return;
    }
    p312 += p231;
    if(r<p312) {
        days[i1].insert(d3);
        days[i2].insert(d1);
        days[i3].insert(d2);
        t[d3] = i1;
        t[d1] = i2;
        t[d2] = i3;
        return;
    }
    days[i1].insert(d3);
    days[i2].insert(d2);
    days[i3].insert(d1);
    t[d3] = i1;
    t[d1] = i3;
}

int main() {
    initTime();
    srand49();
    scanf("%d", &D);
    rep(i, arraysizeof(rnd)) rnd[i] = log(drand49());
    rep(i, I) scanf("%d", &c[i]);
    rep(d, D) rep(i, I) scanf("%d", &s[d][i]);
    rep(d, D) t[d] = d % I;
    rep(d, D) days[t[d]].insert(d);
    cnt = 0;
    while(true) {
        double now = getTime();
        if(limit<=now) {
            break;
        }
        if(!((++cnt) & 15)) {
            constexpr double T0 = 1500.0;
            double progress = now / limit;
            double remain = 1 - progress;
            double remain05 = sqrt(remain);
            constexpr double rate05 = 0.7;
            Tr = (1-rate05) * remain + rate05 * remain05;
            T = T0 * Tr;
        }
        mutateA();
        mutateB();
        mutateC();
    }
    //fprintf(stderr, "cnt = %d\n", cnt);
    rep(d, D) printf("%d\n", t[d]+1);
}


Measured memory_bytes: 3968