#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>
#include <chrono>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

s64 update_score(const set<int>& last, int day, int prev, int c, int max_d)
{
    s64 ret = 0;
    auto itr = last.upper_bound(day);
    int l, r;
    if (itr == last.end())
    {
        r = max_d + 1;
        l = *--itr;
    }
    else
    {
        r = *itr;
        l = *--itr;
    }
    ret -= (s64)((day - prev) + (r - 1 - prev)) * (r - day) / 2;
    ret += (s64)((day - l) + (r - 1 - l)) * (r - day) / 2;

    return c * ret;
}

int main()
{
    chrono::system_clock::time_point start;
    start = chrono::system_clock::now();

    cin.tie(0);
    ios::sync_with_stdio(false);

    const int DAY = 365;
    const int NUM = 26;
    const int LIM = 1900;
    int d;
    cin >> d;
    s64 c[NUM];
    rep (i, NUM)
    {
        cin >> c[i];
        c[i] = -c[i];
    }

    int s[DAY][NUM];
    rep (i, d) rep (j, NUM) cin >> s[i][j];

    set<int> last[NUM];
    rep (i, NUM) last[i].insert(0);

    // random
    int t[DAY];
    int ans[DAY];
    srand(chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count());
    rep (i, d)
    {
        t[i] = rand() % NUM;
        ans[i] = t[i];
    }

    // random
    s64 v;
    v = 0;
    rep (i, d)
    {
        v += s[i][t[i]];
        last[t[i]].insert(i + 1);
        rep (j, NUM)
        {
            v += c[j] * ((i + 1) - *last[j].rbegin());
        }
    }

    s64 max_v = v;
    s64 score = v;
    int T = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();
    int cnt = 0;
    while (T < LIM)
    {
        int dd = cnt++ % d + 1;//random() % d + 1;
        int q = random() % NUM;
        int p = t[dd - 1];
        v += s[dd - 1][q] - s[dd - 1][p];

        last[p].erase(dd);
        last[q].insert(dd);
        auto itr = last[q].lower_bound(dd);
        int prevq = *--itr;

        v += update_score(last[p], dd, dd, c[p], d);
        v += update_score(last[q], dd, prevq, c[q], d);

        if (T < rand() % LIM || score < v)
        {
            t[dd - 1] = q;
            score = v;
            if (max_v < score)
            {
                rep (j, DAY) ans[j] = t[j];
                max_v = score;
            }
        }
        else
        {
            last[p].insert(dd);
            last[q].erase(dd);
            v = score;
        }
        T = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();
    }

    rep (i, d)
    {
        cout << ans[i] + 1 << "\n";
    }

    // cout << "after: " << score << "\n";
    // cout << "cnt = " << cnt << "\n";

    return 0;
}



Measured memory_bytes: 3716