#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

class Timer {
    public:
    void start() {
        origin = rdtsc();
    }
    
    inline double get_time() {
        return (rdtsc() - origin) * SECONDS_PER_CLOCK;
    }
    
    private:
    constexpr static double SECONDS_PER_CLOCK = 1 / 3.0e9;
    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)
    inline static unsigned get(unsigned x) {
        return ((unsigned long long)xorshift() * x) >> 32;
    }
    
    // [x, y]
    inline static unsigned get(unsigned x, unsigned y) {
        return get(y - x + 1) + x;
    }
    
    // [0, x] (x = 2^c - 1)
    inline static unsigned get_fast(unsigned x) {
        return xorshift() & x;
    }
    
    // [0.0, 1.0]
    inline static double probability() {
        return xorshift() * INV_MAX;
    }
    
    inline static bool toss() {
        return xorshift() & 1;
    }
    
    private:
    constexpr static double INV_MAX = 1.0 / 0xFFFFFFFF;
    
    inline static unsigned xorshift() {
        static unsigned long long x = 88172645463325252LL;
        x = x ^ (x << 7);
        return x = x ^ (x >> 9);
    }
};

class simulated_annealing {
    public:
    simulated_annealing();
    inline bool end();
    inline bool accept(double current_score, double next_score);
    void print() const;
    
    private:
    constexpr static bool MAXIMIZE = true;
    constexpr static int LOG_SIZE = 0xFFFF;
    constexpr static int UPDATE_INTERVAL = 0xFF;
    constexpr static double TIME_LIMIT = 1.98;
    constexpr static double START_TEMP = 1500;
    constexpr static double END_TEMP = 1e-9;
    constexpr static double TEMP_RATIO = (END_TEMP - START_TEMP) / TIME_LIMIT;
    double log_probability[LOG_SIZE + 1];
    long long iteration = 0;
    long long accepted = 0;
    long long rejected = 0;
    double time = 0;
    double temp = START_TEMP;
    Timer timer;
};

simulated_annealing::simulated_annealing() {
    timer.start();
    for (int i = 0; i <= LOG_SIZE; i++) {
        double p = (double)(i * 2 + 1) / ((LOG_SIZE + 1) * 2);
        log_probability[i] = log(p) + log(1 - p);
    }
}

inline bool simulated_annealing::end() {
    iteration++;
    if ((iteration & UPDATE_INTERVAL) == 0) {
        time = timer.get_time();
        temp = START_TEMP + TEMP_RATIO * time;
        return time >= TIME_LIMIT;
    } else {
        return false;
    }
}

inline bool simulated_annealing::accept(double current_score, double next_score) {
    double diff = (MAXIMIZE ? next_score - current_score : current_score - next_score);
    if (diff >= 0 || diff > log_probability[Random::get_fast(LOG_SIZE)] * temp) {
        accepted++;
        return true;
    } else {
        rejected++;
        return false;
    }
}

void simulated_annealing::print() const {
    fprintf(stderr, "iteration: %lld\n", iteration);
    fprintf(stderr, "accepted: %lld\n", accepted);
    fprintf(stderr, "rejected: %lld\n", rejected);
}

const int C = 26;
const int D = 365;
const int DIFF = 15;
int c[C];
int s[D][C];
int ans[D];
int best_ans[D];
int prev_contest[C][D + 2];
int next_contest[C][D + 2];

inline void update_prev(int day1, int day2, int type, int day) {
    for (int i = day1; i <= day2; i++) prev_contest[type][i + 1] = day;
}

inline void update_next(int day1, int day2, int type, int day) {
    for (int i = day1; i <= day2; i++) next_contest[type][i + 1] = day;
}

int main() {
    int score = 0, best_score = 0, cnt = 0, i, j;
    simulated_annealing sa;
    
    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++) {
        update_prev(0, C, i, -1);
        update_next(D - C, D, i, D);
    }
    
    for (i = 0; i < D; i++) {
        ans[i] = i % C;
        score += s[i][ans[i]];
        update_prev(i + 1, min(i + C, D), ans[i], i);
        update_next(max(i - C, 0), i - 1, ans[i], i);
    }
    
    for (i = 0; i < D; i++) {
        for (j = 0; j < C; j++) {
            if (ans[i] == j) continue;
            score -= c[j] * (i - prev_contest[j][i + 1]);
        }
    }
    
    best_score = score;
    
    while (!sa.end()) {
        cnt++;
        if (cnt & 1) {
            int day = Random::get(D);
            int type1 = ans[day];
            int type2 = Random::get(C);
            int next_score = score;
            int type1_prev, type1_next, type2_prev, type2_next;
            
            if (type1 == type2) continue;
            
            type1_prev = prev_contest[type1][day + 1];
            type1_next = next_contest[type1][day + 1];
            type2_prev = prev_contest[type2][day + 1];
            type2_next = next_contest[type2][day + 1];
            
            next_score -= s[day][type1];
            next_score += s[day][type2];
            
            next_score -= c[type1] * (day - type1_prev) * (type1_next - day);
            next_score += c[type2] * (day - type2_prev) * (type2_next - day);
            
            if (sa.accept(score, next_score)) {
                update_prev(day + 1, type1_next, type1, type1_prev);
                update_next(type1_prev, day - 1, type1, type1_next);
                update_prev(day + 1, type2_next, type2, day);
                update_next(type2_prev, day - 1, type2, day);
                ans[day] = type2;
                score = next_score;
                
                if (score > best_score) {
                    best_score = score;
                    for (i = 0; i < D; i++) best_ans[i] = ans[i];
                }
            }
        } else {
            int diff = Random::get_fast(DIFF) + 1;
            int day1 = Random::get(D - diff);
            int day2 = day1 + diff;
            int type1 = ans[day1];
            int type2 = ans[day2];
            int next_score = score;
            int type1_prev, type1_next, type2_prev, type2_next;
            
            if (type1 == type2) continue;
            
            type1_prev = prev_contest[type1][day1 + 1];
            type1_next = next_contest[type1][day1 + 1];
            type2_prev = prev_contest[type2][day2 + 1];
            type2_next = next_contest[type2][day2 + 1];
            
            if (type1_next <= day2) continue;
            if (type2_prev >= day1) continue;
            
            next_score -= s[day1][type1];
            next_score += s[day1][type2];
            next_score -= s[day2][type2];
            next_score += s[day2][type1];
            
            next_score -= c[type1] * (day2 - day1) * (day1 + day2 - type1_prev - type1_next);
            next_score += c[type2] * (day2 - day1) * (day1 + day2 - type2_prev - type2_next);
            
            if (sa.accept(score, next_score)) {
                update_prev(day1 + 1, day2, type1, type1_prev);
                update_prev(day2 + 1, type1_next, type1, day2);
                update_next(type1_prev, day2 - 1, type1, day2);
                update_prev(day1 + 1, type2_next, type2, day1);
                update_next(type2_prev, day1 - 1, type2, day1);
                update_next(day1, day2 - 1, type2, type2_next);
                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);
    
    sa.print();
    fprintf(stderr, "best_score: %d\n", best_score + 1000000);
    
    return 0;
}


Measured memory_bytes: 3124