#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;
const int DIFF = 15;
const int INTERVAL = 0xFF;
int c[C];
int s[D][C];
int down[C];
int num[D];
int candidate[D][C * 100];
int ans[D];
int best_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, best_score = 0, cnt = 0, i, j, k;
    double t = 0;
    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 < D; i++) {
        for (j = 0; j < C; j++) {
            int x = s[i][j] / 200;
            
            for (k = 0; k <= x; k++) candidate[i][num[i]++] = j;
        }
    }
    
    for (i = 0; i < C; i++) {
        last[i].insert(-1);
        last[i].insert(D);
    }
    
    for (i = 0; i < D; i++) {
        int index = i % C;
        
        for (j = 0; j < C; j++) down[j] += c[j];
        
        down[index] = 0;
        last[index].insert(i);
        best_ans[i] = ans[i] = index;
        
        score += s[i][index];
        for (j = 0; j < C; j++) score -= down[j];
    }
    
    best_score = score;
    
    for (; ; cnt++) {
        if ((cnt & INTERVAL) == 0) t = timer.get_time();
        
        if (t >= 1.98) break;
        
        if (Random::toss()) {
            int day = Random::get(D);
            int type = candidate[day][Random::get(num[day])];
            int index = ans[day];
            int next_score = score;
            
            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;
                
                if (score > best_score) {
                    best_score = score;
                    for (i = 0; i < D; i++) best_ans[i] = ans[i];
                }
            }
        } else {
            int day1 = Random::get(D - DIFF);
            int day2 = day1 + Random::get_fast(DIFF);
            int type1 = ans[day1];
            int type2 = ans[day2];
            int next_score = score;
            
            if (day1 == day2) continue;
            
            next_score -= s[day1][type1];
            next_score += s[day1][type2];
            next_score -= s[day2][type2];
            next_score += s[day2][type1];
            
            if (type1 != type2) {
                {
                    int daya = last[type1].rupper_bound(day1);
                    int dayb = last[type1].upper_bound(day1);
                    
                    next_score -= c[type1] * (day1 - daya) * (dayb - day1);
                }
                
                {
                    int daya = last[type2].rupper_bound(day2);
                    int dayb = last[type2].upper_bound(day2);
                    
                    next_score -= c[type2] * (day2 - daya) * (dayb - day2);
                }
                
                last[type1].erase(day1);
                last[type2].erase(day2);
                
                {
                    int daya = last[type2].rupper_bound(day1);
                    int dayb = last[type2].upper_bound(day1);
                    
                    next_score += c[type2] * (day1 - daya) * (dayb - day1);
                }
                
                {
                    int daya = last[type1].rupper_bound(day2);
                    int dayb = last[type1].upper_bound(day2);
                    
                    next_score += c[type1] * (day2 - daya) * (dayb - day2);
                }
                
                last[type1].insert(day1);
                last[type2].insert(day2);
            }
            
            if (accept(t, score, next_score)) {
                last[type1].erase(day1);
                last[type2].erase(day2);
                last[type1].insert(day2);
                last[type2].insert(day1);
                ans[day1] = type2;
                ans[day2] = type1;
                score = next_score;
                
                if (score > best_score) {
                    best_score = score;
                    for (i = 0; i < D; i++) best_ans[i] = ans[i];
                }
            }
        }
    }
    
    for (i = 0; i < D; i++) printf("%d\n", best_ans[i] + 1);
    
    fprintf(stderr, "count: %d\n", cnt);
    fprintf(stderr, "best_score: %d\n", best_score + 1000000);
    
    return 0;
}


Measured memory_bytes: 6120