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

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 = 1800.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();
    }
    //fprintf(stderr, "cnt = %d\n", cnt);
    rep(d, D) printf("%d\n", t[d]+1);
}


Measured memory_bytes: 3772