#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cassert>
#include <cmath>
#include <set>

//#define IS_LOCAL

/*******************************************************************************
 Utility
*******************************************************************************/
#define for_(i,a,b) for(int i=a;i<b;++i)
#define INIT(a,b) std::memset(a,b,sizeof(a))
#define FILL(a,b,c) std::fill(a,a+b,c)
#define ALL(a) a.begin(),a.end()
using pii = std::pair<int, int>;

#include <sys/time.h>
struct Timer {
	struct timeval start, cur;

	Timer() { gettimeofday(&start, NULL); }
	
    double curTime() {
		gettimeofday(&cur, NULL);
		return (cur.tv_sec - start.tv_sec) +
               (cur.tv_usec - start.tv_usec) / 1e6;
	}
};

struct XorShift {
    unsigned int x, y, z, w;
    
    XorShift() { init(); }
    XorShift(unsigned int seed) { init(seed); }
    
    void init(unsigned int seed = 88675123) {
        x = 123456789; y = 362436069; z = 521288629; w = seed;
    }
    
    void setNext() {
        unsigned int t = x ^ (x << 11);
        x = y; y = z; z = w;
        w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
    }
    
    unsigned int nextInt() { setNext(); return w; }
    
    unsigned int nextInt(unsigned int n) { return nextInt() % n; }
    
    unsigned int nextInt(unsigned int a, unsigned int b) {
        assert(a <= b); 
        return a + nextInt(b - a + 1);
    }
    
    double nextDouble() { return nextInt() * (1.0 / 0xFFFFFFFFu); }

    template<typename T> void shuffle(std::vector<T>& v) {
        int n = v.size();
        for_(i,0,n) {
            int j = this->nextInt(n - i);
            std::swap(v[n - i - 1], v[j]);
        }
    }

    template<typename T> T choice(const std::vector<T>& v) {
        int n = v.size();
        int i = this->nextInt(n);
        return v[i];
    }
};

/*******************************************************************************
 Solver
*******************************************************************************/
int D, c[26], s[365][26];

int compute_score(const std::vector<int>& sol) {
    int score = 0;
    int n = sol.size();
    std::vector<int> last(26, -1);
    for_(d,0,n) {
        int x = sol[d];
        last[x] = d;
        score += s[d][x];
        for_(i,0,26) {
            int tmp = d - last[i];
            score -= c[i] * tmp;
        }
    }
    return score;
}

std::vector<int> greedy() {
    std::vector<int> ret;
    for_(d,0,D) {
        int best_i = -1, best_score = -(1L << 30);
        for_(i,0,26) {
            ret.push_back(i);
            int score = compute_score(ret);
            if (best_score < score) {
                best_score = score;
                best_i = i;
            }
            ret.pop_back();
        }
        ret.push_back(best_i);
    }
    return ret;
}

// std::vector<int> simple_order() {
//     std::vector<int> ret;
//     int i = 0;
//     for_(d,0,D) {
//         ret.push_back(i);
//         i = (i + 1) % 26;
//     }
//     return ret;
// }

std::vector<int> simulated_annearling() {
    Timer timer;
    XorShift my_random;

    std::vector<int> cur = greedy();
    int cur_score = compute_score(cur);

    std::vector<int> best = cur;
    int best_score = cur_score;

    //
    std::vector<std::set<int>> days(26, {-1, 365});
    for_(d,0,D) {
        int x = cur[d];
        days[x].insert(d);
    }

    auto get_interval = [&](int i, int d) {
        auto it = days[i].upper_bound(d);
        int nxt = *it;
        --it;
        int prv = *it;
        return pii(prv, nxt);
    };

    auto compute_decline = [&](int i, int term) {
        int mul = term * (term + 1) / 2;
        return c[i] * mul;
    };

    auto compute_diff = [&](int d, int i) {
        int p = cur[d];
        days[p].erase(d);
        //
        int diff = s[d][i] - s[d][p];
        //
        pii a = get_interval(p, d);
        diff += compute_decline(p, d - a.first - 1);
        diff += compute_decline(p, a.second - d - 1);
        diff -= compute_decline(p, a.second - a.first - 1);
        //
        pii b = get_interval(i, d);
        diff -= compute_decline(i, d - b.first - 1);
        diff -= compute_decline(i, b.second - d - 1);
        diff += compute_decline(i, b.second - b.first - 1);
        //
        days[p].insert(d);
        return diff;
    };
    //

    double T = 2000, COLD = 0.9993;
    auto accept = [&](int diff) {
        if (diff > 0) return true;
        return my_random.nextDouble() < exp(diff / T);
    };

    int rep_count = 0;
    int last_upd = -1;
    double last_T = -1;
    while (timer.curTime() < 1.95) {
        for_(REP,0,10000) {
            int d = my_random.nextInt(D);
            int i = my_random.nextInt(26);
            int diff = compute_diff(d, i);
            if (accept(diff)) {
                int p = cur[d];
                cur[d] = i;
                days[p].erase(d);
                days[i].insert(d);
                cur_score += diff;
                if (best_score < cur_score) {
                    best = cur;
                    best_score = cur_score;
                    //
                    #ifdef IS_LOCAL
                    std::cerr << "Update: " << best_score
                              << " Temp: " << T
                              << std::endl;
                    last_upd = rep_count;
                    last_T = T;
                    #endif
                }
            }
            ++rep_count;
        }
        T *= COLD;
    }
    
    #ifdef IS_LOCAL
    std::cerr << " Rep: " << rep_count
              << " Score: " << best_score
              << " Upd: " << last_upd
              << " Upd T: " << last_T
              << " T: " << T
              << std::endl;
    #endif
    
    return best;
}

void output(const std::vector<int>& sol) {
    for (int t : sol) std::cout << t + 1 << std::endl;
}

void solve() {
    std::vector<int> sol = simulated_annearling();
    output(sol);
}

/*******************************************************************************
 main
*******************************************************************************/
int main() {
    std::cin >> D;
    for_(i,0,26) std::cin >> c[i];
    for_(d,0,D) for_(i,0,26) std::cin >> s[d][i];
    solve();
}

Measured memory_bytes: 4352