#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 rep(i, n) for(int i=0; i<(int)(n); ++i)
constexpr int I = 26;
constexpr double limit = 0.95;
int D;
int c[I];
int s[365][I];
int t[365];
double now;
set<int> days[I];

bool accept(int dSc) {
    if(0<=dSc) return true;
    constexpr double T0 = 1800.0;
    double progress = now / limit;
    double remain = 1 - progress;
    double remain05 = sqrt(remain);
    constexpr double rate05 = 0.7;
    double Tr = (1-rate05) * remain + rate05 * remain05;
    double T = T0 * Tr;
    return drand49() < exp(dSc / T);
}

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 d1, d2;
    constexpr int dd = 5;
    while(true) {
        d1 = lrand49(D);
        d2 = d1 + lrand49(dd+dd+1) - dd;
        if(d1!=d2 && 0<=d2 && d2<D) {
            if(d2<d1) swap(d1, d2);
            break;
        }
    }
    int i1 = t[d1];
    int i2 = t[d2];
    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();
    scanf("%d", &D);
    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);
    while(true) {
        now = getTime();
        if(limit<=now) {
            break;
        }
        mutateA();
        mutateB();
    }
    rep(d, D) printf("%d\n", t[d]+1);
}


Measured memory_bytes: 3980