#include <bits/stdc++.h>

using namespace std;

class xor_shift_128 {
public:
    typedef uint32_t result_type;
    explicit xor_shift_128(uint32_t seed = 42) {
        set_seed(seed);
    }
    void set_seed(uint32_t seed) {
        a = seed = 1812433253u * (seed ^ (seed >> 30));
        b = seed = 1812433253u * (seed ^ (seed >> 30)) + 1;
        c = seed = 1812433253u * (seed ^ (seed >> 30)) + 2;
        d = seed = 1812433253u * (seed ^ (seed >> 30)) + 3;
    }
    uint32_t operator() () {
        uint32_t t = (a ^ (a << 11));
        a = b; b = c; c = d;
        return d = (d ^ (d >> 19)) ^ (t ^ (t >> 8));
    }
    static constexpr uint32_t max() { return numeric_limits<result_type>::max(); }
    static constexpr uint32_t min() { return numeric_limits<result_type>::min(); }
private:
    uint32_t a{}, b{}, c{}, d{};
};

const int CONTEST_NUM = 26;

struct State {
    vector<int> contest_order;
    State(const int D) : contest_order(vector<int>(D+1)) {}
};

template <class Generator>
int choose(int const min, int const max, Generator & gen) {
    assert (min <= max);
    return uniform_int_distribution<int>(min, max)(gen);
}

long long compute_score(const State& state, const vector<int> & costs, const vector<vector<int>> & values, const int D) {
    long long score = 0;
    vector<int> last(CONTEST_NUM+1, 0);
    for (int i=1; i<=D; i++) {
        score += values[i][state.contest_order[i]];
        last[state.contest_order[i]] = i;
        for (int j=1; j<=CONTEST_NUM; j++) {
            score -= costs[j] * (i - last[j]);
        }
    }
    return score;
}

long long compute_diff(const State& state, const vector<int> & costs, const vector<vector<int>> & values, const int D, const int day, const int newContestId) {
    const int oldContestId = state.contest_order[day];
    if (oldContestId == newContestId) return 0;
    long long diff = values[day][newContestId] - values[day][oldContestId];
    vector<int> last(CONTEST_NUM+1, 0), newLast(CONTEST_NUM+1, 0);
    for (int i=1; i<=D; i++) {
        if (i == day) {
            last[oldContestId] = i;
            newLast[newContestId] = i;
        } else {
            last[state.contest_order[i]] = i;
            newLast[state.contest_order[i]] = i;
        }
        diff -= costs[oldContestId] * (i - newLast[oldContestId]) + costs[newContestId] * (i - newLast[newContestId])
                - (costs[oldContestId] * (i - last[oldContestId]) + costs[newContestId] * (i - last[newContestId]));
    }
    return diff;
}

template <class Generator>
State solve(const vector<int> & costs, const vector<vector<int>> & values, const int D, Generator & gen) {
    State best_state(D), state(D);

    if (getenv("RESUME")) {
        ifstream ifs(getenv("RESUME"));
        string line;
        getline(ifs, line);
        int cnt = 0;
        while (getline(ifs, line)) {
            cnt++;
            if (cnt % 2 == 0) continue;
            stringstream ss_line(line);
        }
    } else {  // make an initial state
        vector<int> last(CONTEST_NUM+1, 0);
        for (int i=1; i<=D; i++) {
            long long maxDiff = LLONG_MIN, contestId = -1;
            for(int j=1; j<=CONTEST_NUM; j++) {
                long long diff = values[i][j];
                for(int k=1; k<=CONTEST_NUM; k++) {
                    if (k==j) continue;
                    diff -= costs[k] * (i - last[k]);
                }
                if (diff > maxDiff) {
                    maxDiff = diff;
                    contestId = j;
                }
            }
            assert(contestId != -1);
            state.contest_order[i] = contestId;
            last[state.contest_order[i]] = i;
        }
    }

    best_state = state;
    long long score = compute_score(state, costs, values, D);
    long long highscore = score;
    cerr << "[*] highscore = " << highscore << endl;

    constexpr int TIME_LIMIT = 1950;  // msec
    chrono::high_resolution_clock::time_point clock_begin = chrono::high_resolution_clock::now();
    double temperature = 1;
    for (unsigned iteration = 0; ; ++ iteration) {
        if (iteration % 20 == 0) {
            chrono::high_resolution_clock::time_point clock_end = chrono::high_resolution_clock::now();
            temperature = 1 - 1.0 * chrono::duration_cast<chrono::milliseconds>(clock_end - clock_begin).count() / TIME_LIMIT;
            if (temperature <= 0) {
                cerr << "[*] iteration = " << iteration << ": done" << endl;
                break;
            }
        }

        State oldState = state;
        long long delta;
        constexpr double parameter = 2500.0;

        if (bernoulli_distribution(temperature)(gen)) {
            const int day = choose(1, D, gen);
            long long maxDiff = LLONG_MIN;
            int newContestId = -1;
            for (int i=1; i<=CONTEST_NUM; i++) {
                long long diff = compute_diff(state, costs, values, D, day, i);
                if (maxDiff < diff) {
                    maxDiff = diff;
                    newContestId = i;
                }
            }
            state.contest_order[day] = newContestId;

            long long newScore = compute_score(state, costs, values, D);
            delta = newScore - score;
        } else {
            const int day1 = choose(1, D, gen);
            const int day2 = choose(max(1,day1-10), min(D,day1+10), gen);
            long long newScore = score;
            if (day1 != day2) {
                int tmp = state.contest_order[day1];
                state.contest_order[day1] = state.contest_order[day2];
                state.contest_order[day2] = tmp;
                newScore = compute_score(state, costs, values, D);
            }
            delta = newScore - score;
        }

        if (delta >= 0 or bernoulli_distribution(exp(delta / (1.0+parameter*temperature)))(gen)) {
            if (delta < 0) {
                cerr << "[*] iteration = " << iteration << ": delta = " << delta << ": p = " << exp(delta / (1.0+parameter*temperature)) << endl;
            }
            score += delta;
            if (highscore < score) {
                highscore = score;
                best_state = state;
                cerr << "[*] iteration = " << iteration << ": highscore = " << highscore << endl;
            }
        } else {
            // resume
            state = oldState;
        }
    }

    cerr << "[*] highscore = " << highscore << endl;

    return best_state;
}

int main() {
    int D;
    scanf("%lld",&D);
    std::vector<int> c(CONTEST_NUM+1);
    for(int i = 1 ; i <= 26 ; i++){
        scanf("%lld",&c[i]);
    }
    std::vector<std::vector<int>> s(D+1, std::vector<int>(CONTEST_NUM+1));
    for(int i = 1 ; i <= D ; i++){
        for(int j = 1 ; j <= 26 ; j++){
            scanf("%lld",&s[i][j]);
        }
    }

    // solve
    xor_shift_128 gen;
    State state = solve(std::move(c), std::move(s), D, gen);

    // output
    stringstream ss;
    for (int i=1; i<=D; i++) {
        ss << state.contest_order[i] << "\n";
    }
    cout << ss.str();
    return 0;
}


Measured memory_bytes: 4536