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

namespace mm {
    inline unsigned int asm_mul_hi(unsigned int x, unsigned int y) {
        __asm__ __volatile__("mul %%edx" : "+a"(x), "+d"(y));
        return y;
    }

    inline unsigned int asm_mul_lo(unsigned int x, unsigned int y) {
        __asm__ __volatile__("mul %%edx" : "+a"(x), "+d"(y));
        return x;
    }

    inline unsigned int asm_mul_hi(unsigned int x) {
        unsigned int y;
        __asm__ __volatile__("mul %%eax" : "+a"(x), "=d"(y));
        return y;
    }

    inline unsigned int asm_mul_lo(unsigned int x) {
        unsigned int y;
        __asm__ __volatile__("mul %%eax" : "+a"(x), "=d"(y));
        return x;
    }

    inline unsigned int asm_div(unsigned long long x, unsigned int y) {
        unsigned int z;
        __asm__ __volatile__("div %4" : "=a"(y), "=d"(z) : "a"(*(unsigned int*)&x), "d"(*(1+(unsigned int*)&x)), "r"(y));
        return y;
    }

    inline unsigned int asm_div(unsigned int x, unsigned int y) {
        __asm__ __volatile__("div %2" : "+a"(x) : "d"(0), "r"(y));
        return x;
    }
}

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

constexpr int D = 365;
constexpr int I = 26;

int c[I];
int s[D][I];
int t[D];
set<int> days[I];

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

int main() {
    initTime();
    srand49();
    {
        int D2;
        scanf("%d", &D2);
        assert(D==D2);
    }
    for(int i=0; i<I; ++i) {
        scanf("%d", &c[i]);
    }
    for(int d=0; d<D; ++d) {
        for(int i=0; i<I; ++i) {
            scanf("%d", &s[d][i]);
        }
    }
    for(int d=0; d<D; ++d) {
        int i = d % I;
        t[d] = i;
        days[i].insert(d);
    }
    constexpr double limit = 1.95;
    while(true) {
        double now = getTime();
        if(limit <= now) {
            break;
        }
        int d = lrand49(D);
        int prevI = t[d];
        int nextI = lrand49(I-1);
        if(prevI<=nextI) {
            ++nextI;
        }
        auto prevIte = days[prevI].find(d);
        assert(prevIte!=days[prevI].end());
        int pbD = 0;
        int paD = D;
        {
            if(prevIte!=days[prevI].begin()) {
                auto prevPIte = prevIte; --prevPIte;
                pbD = *prevPIte;
            }
            ++prevIte;
            if(prevIte!=days[prevI].end()) {
                paD = *prevIte;
            }
        }
        int naD = D;
        int nbD = 0;
        {
            auto nextIte = days[nextI].lower_bound(d);
            assert(nextIte==days[nextI].end() || *nextIte!=d);
            if(nextIte!=days[nextI].end()) {
                naD = *nextIte;
            }
            if(nextIte!=days[nextI].begin()) {
                --nextIte;
                nbD = *nextIte;
            }
        }
        int dSc = (s[d][nextI] - (pena(naD-d)+pena(d-nbD)-pena(naD-nbD))*c[nextI])
                - (s[d][prevI] - (pena(paD-d)+pena(d-pbD)-pena(paD-pbD))*c[prevI]);
        bool accept = false;
        if(0<=dSc) {
            accept = true;
        }
        else {
            constexpr double T0 = 1400.0;
            double remain = now / limit;
            double remain05 = sqrt(remain);
            //double remain2 = remain * remain;
            //double progress = 1 - remain;
            constexpr double rate05 = 0.9;
            double Tr = (1-rate05) * remain + rate05 * remain05;
            double T = T0 * Tr;
            if(drand49() < exp(dSc / T)) {
                accept = true;
            }
        }
        if(accept) {
            days[prevI].erase(d);
            t[d] = nextI;
            days[nextI].insert(d);
        }
    }
    for(int d=0; d<D; ++d) {
        printf("%d\n", t[d] + 1);
    }

    return 0;
}


Measured memory_bytes: 3948