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

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 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 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++) log_probability[i] = log(Random::probability());
}

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);
}

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

int main() {
    int score = 0, best_score = 0, cnt = 0, i, j, k;
    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 < 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;
    
    while (!sa.end()) {
        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 (sa.accept(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 day1_prev, day1_next, day2_prev, day2_next;
            int type1 = ans[day1];
            int type2 = ans[day2];
            int next_score = score;
            
            if (day1 == day2 || type1 == type2) continue;
            
            day1_next = last[type1].upper_bound(day1);
            if (day1_next <= day2) continue;
            
            day2_prev = last[type2].rupper_bound(day2);
            if (day2_prev >= day1) continue;
            
            next_score -= s[day1][type1];
            next_score += s[day1][type2];
            next_score -= s[day2][type2];
            next_score += s[day2][type1];
            
            day1_prev = last[type1].rupper_bound(day1);
            day2_next = last[type2].upper_bound(day2);
            
            next_score -= c[type1] * (day2 - day1) * (day1 + day2 - day1_prev - day1_next);
            next_score += c[type2] * (day2 - day1) * (day1 + day2 - day2_prev - day2_next);
            
            if (sa.accept(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);
    
    sa.print();
    fprintf(stderr, "best_score: %d\n", best_score + 1000000);
    
    return 0;
}


Measured memory_bytes: 6368