#include <bits/stdc++.h>

using namespace std;

u_int seed = 3;
u_int xor_shift()
{
    seed ^= seed << 1;
    seed ^= seed >> 3;
    seed ^= seed << 10;
    return seed;
}

chrono::system_clock::time_point start_time;
int elapsed()
{
    auto cur = chrono::system_clock::now();
    return chrono::duration_cast<chrono::milliseconds>(cur - start_time).count();
}

// セグ木を使えば二分探索で一点をlog(n)で更新できる これ嘘で，後ろのスコアも変更する必要があるため
// 前からA*とかビームサーチもできそう
// とりあえず焼きなます
// 最初はCを考慮せずに焼きなます(いや，貪欲でいいだろ)
int score = 0;
int d;
vector<int> T, C;
vector<vector<int>> S, last;

// i日目をj番目に
int calc(int i, int to){
    int res = 0;
    int from = T[i];
    res -= S[i][from];
    int l = i == 0 ? -1 : last[i - 1][from];
    for (int j = i; j < d; j++){
        if (last[j][from] != i)
            break;
        res += C[from] * (j - last[j][from]);
        res -= C[from] * (j - l);
    }

    res += S[i][to];
    for (int j = i; j < d; j++){
        if (last[j][to] > i)
            break;
        res += C[to] * (j - last[j][to]);
        res -= C[to] * (j - i);
    }

    return res;
}

void change(int i, int to){
    int from = T[i];
    T[i] = to;
    int l = i == 0 ? -1 : last[i - 1][from];
    for (int j = i; j < d; j++){
        if (last[j][from] != i)
            break;
        last[j][from] = l;
    }

    for (int j = i; j < d; j++){
        if (last[j][to] > i)
            break;
        last[j][to] = i;
    }
}

int calc_overall(){
    int res = 0;
    for (int i = 0; i < d; i++){
        res += S[i][T[i]];
        for (int j = 0; j < 26; j++){
            res -= C[j] * (i - last[i][j]);
        }
    }

    return res;
}


int main(){
    cin >> d;
    start_time = chrono::system_clock::now();
    C.resize(26);
    copy_n(istream_iterator<int>(cin), 26, C.begin());
    S.assign(d, vector<int>(26));
    last.assign(d, vector<int>(26, -1));
    for (auto &s: S)
        copy_n(istream_iterator<int>(cin), 26, s.begin());

    T.resize(d);

    for (int i = 0; i < d; i++){
        // int to = max_element(S[i].begin(), S[i].end()) - S[i].begin();
        int to = xor_shift() % 26;
        T[i] = to;
        for (int j = i; j < d; j++){
            last[j][to] = i;
        }
    }

    auto ans = T;
    score = calc_overall();
    cerr << score << endl;
    int max_score = score;
    const constexpr double s_temp = 2494.235808557109, e_temp = 1;
    const constexpr int L = 5e6;
    double delta = (s_temp - e_temp) / L;
    double temp = s_temp;
    const double sup = pow(2, 32) - 1;
    const constexpr int time_limit = 1970;

    while (elapsed() < time_limit){
        auto i = xor_shift() % d;
        auto to = xor_shift() % 26;
        if (T[i] == to)
            continue;
        auto cost = calc(i, to);
        if (cost > 0 or exp(cost / temp) > xor_shift() / sup){
            change(i, to);
            // cerr << "change: " << i << " " << to << " " << cost << " " << temp << endl;
            score += cost;
        }
        if (score > max_score){
            ans = T;
            max_score = score;
        }
        // if (temp > e_temp)
        //     temp -= delta;
        temp = s_temp + (e_temp - s_temp) * elapsed() / time_limit;
    }

    cerr << temp << endl;
    for (const auto &t: ans)
        cout << t + 1 << endl;

    cerr << max_score << endl;

}


Measured memory_bytes: 4480