#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

class Timer {
    public:
    void start() {
        origin = rdtsc();
    }
    
    double get_time() {
        return (rdtsc() - origin) / 3.0e9;
    }
    
    private:
    unsigned long long origin;
    
    inline static unsigned long long rdtsc() {
        unsigned long long lo, hi;
        __asm__ volatile ("rdtsc" : "=a" (lo), "=d" (hi));
        return (hi << 32) | lo;
    }
};

class Random {
    public:
    // [0, x)
    static unsigned get(unsigned x) {
        return xorshift() % x;
    }
    
    // [x, y]
    static unsigned get(unsigned x, unsigned y) {
        return get(y - x + 1) + x;
    }
    
    static unsigned get_fast(unsigned x) {
        return xorshift() & x;
    }
    
    static bool toss() {
        return xorshift() & 1;
    }
    
    private:
    inline static unsigned xorshift() {
        static unsigned x = 123456789, y = 362436039, z = 521288629, w = 88675123;
        unsigned t = x ^ (x << 11);
        x = y, y = z, z = w;
        return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
    }
};

class fast_set {
    public:
    fast_set() : fast_set(-1, 365) {};
    fast_set(int max) : fast_set(0, max) {};
    fast_set(int min, int max);
    ~fast_set();
    int count(int key) const;
    void insert(int key);
    void erase(int key);
    int lower_bound(int key) const;
    int upper_bound(int key) const;
    int rlower_bound(int key) const;
    int rupper_bound(int key) const;
    
    private:
    int min;
    int max;
    int depth;
    int index[5];
    unsigned long long* data;
};

fast_set::fast_set(int min, int max) : min(min), max(max), depth((31 - __builtin_clz(max - min)) / 6 + 1) {
    for (int i = 0, n = (max - min + 64) >> 6; i < depth; i++, n = (n + 63) >> 6) index[i + 1] = index[i] + n;
    data = (unsigned long long *)calloc(index[depth], sizeof(unsigned long long));
}

fast_set::~fast_set() {
    free(data);
}

int fast_set::count(int key) const {
    key -= min;
    return (data[key >> 6] >> (key & 63)) & 1;
}

void fast_set::insert(int key) {
    key -= min;
    for (int i = 0; i < depth; i++, key >>= 6) data[index[i] + (key >> 6)] |= 1ULL << (key & 63);
}

void fast_set::erase(int key) {
    key -= min;
    for (int i = 0; i < depth && (i == 0 || data[index[i - 1] + key] == 0); i++, key >>= 6) data[index[i] + (key >> 6)] &= ~(1ULL << (key & 63));
}

int fast_set::lower_bound(int key) const {
    key -= min;
    for (int i = 0; i < depth && key >> 6 < index[i + 1] - index[i]; i++, key = (key >> 6) + 1) {
        unsigned long long next = data[index[i] + (key >> 6)] >> (key & 63);
        if (next == 0) continue;
        key += __builtin_ctzll(next);
        while (i > 0) key = (key << 6) | __builtin_ctzll(data[index[--i] + key]);
        return key + min;
    }
    return max + 1;
}

int fast_set::upper_bound(int key) const {
    return lower_bound(key + 1);
}

int fast_set::rlower_bound(int key) const {
    key -= min;
    for (int i = 0; i < depth && key >= 0; i++, key = (key >> 6) - 1) {
        unsigned long long prev = data[index[i] + (key >> 6)] << (63 - (key & 63));
        if (prev == 0) continue;
        key -= __builtin_clzll(prev);
        while (i > 0) key = (key << 6) | (63 - __builtin_clzll(data[index[--i] + key]));
        return key + min;
    }
    return min - 1;
}

int fast_set::rupper_bound(int key) const {
    return rlower_bound(key - 1);
}

const int C = 26;
const int D = 365;
int c[C];
int s[D][C];
int down[C];
int ans[D];
fast_set last[C];

bool accept(double current_time, double current_score, double next_score) {
    if (next_score > current_score) return true;
    
    const int x = 65535;
    const double start_temp = 10000;
    const double end_temp = 100;
    double temp = start_temp + (end_temp - start_temp) * current_time * 0.5;
    double prob = exp((next_score - current_score) / temp);
    return prob * x > Random::get_fast(x);
}

int main() {
    int score = 0, cnt = 0, i, j;
    Timer timer;
    
    timer.start();
    
    scanf("%*d");
    
    for (i = 0; i < C; i++) scanf("%d", &c[i]);
    
    for (i = 0; i < D; i++) {
        for (j = 0; j < C; j++) {
            scanf("%d", &s[i][j]);
        }
    }
    
    for (i = 0; i < C; i++) {
        last[i].insert(-1);
        last[i].insert(D);
    }
    
    for (i = 0; i < D; i++) {
        int best = -1e9, index = -1;
        
        for (j = 0; j < C; j++) down[j] += c[j];
        
        for (j = 0; j < C; j++) {
            int sum = s[i][j] + down[j];
            
            if (sum > best) {
                best = sum;
                index = j;
            }
        }
        
        down[index] = 0;
        last[index].insert(i);
        ans[i] = index;
        
        score += s[i][index];
        for (j = 0; j < C; j++) score -= down[j];
    }
    
    for (; ; cnt++) {
        double t = timer.get_time();
        int day = Random::get(D);
        int type = Random::get(C);
        int index = ans[day];
        int next_score = score;
        
        if (t >= 1.95) break;
        
        if (index == type) continue;
        
        next_score -= s[day][index];
        next_score += s[day][type];
        
        {
            int day1 = last[index].rupper_bound(day);
            int day2 = last[index].upper_bound(day);
            
            next_score -= c[index] * (day - day1) * (day2 - day);
        }
        
        {
            int day1 = last[type].rupper_bound(day);
            int day2 = last[type].upper_bound(day);
            
            next_score += c[type] * (day - day1) * (day2 - day);
        }
        
        if (accept(t, score, next_score)) {
            last[index].erase(day);
            last[type].insert(day);
            ans[day] = type;
            score = next_score;
        }
    }
    
    for (i = 0; i < D; i++) printf("%d\n", ans[i] + 1);
    
    fprintf(stderr, "count: %d\n", cnt);
    fprintf(stderr, "score: %d\n", score + 1000000);
    
    return 0;
}


Measured memory_bytes: 2788