#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <random>
#include <chrono>
using namespace std;
using ll = long long;

ll scoring(vector<int>& schedule);
ll calcSwap(vector<set<int>>& sched, vector<int>& schedule, int d1, int d2);
ll calcDiff(vector<set<int>>& sched, vector<int>& schedule, int d, int q);

int D;
vector<int> decline(26);
vector<vector<int>> satis(365, vector<int>(26));
random_device rnd;
std::mt19937 mt(rnd());
chrono::system_clock::time_point  start;

void solve_greedy(vector<int>& schedule){
    vector<int> lastHeld(26,0);
    for(int d = 0;d < D;d++){
        int sel = 0;
        for(int i = 0;i < 26;i++){
            if(satis[d][i] + decline[i] * (d - lastHeld[i]) > satis[d][sel] + decline[sel] * (d - lastHeld[sel])){
                sel = i;
            }
        }
        schedule[d] = sel;
        lastHeld[sel] = d;
    }
}

void solve_chRand(vector<int>& schedule){
    vector<set<int>> dates(26,set<int>());
    for(int i = 0;i < D;i++){
        dates[schedule[i]].insert(i);
    }
    for(int i = 0;i < 26;i++){
        dates[i].insert(-1);
        dates[i].insert(D);
    }
    auto end = std::chrono::system_clock::now();
    while(std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() < 1900){
        if(mt() % 5 == 0){
            int d = mt() % D;
            int q = mt() % 26;
            // cout<<d<<q<<endl;
            // cout<<clock()-start<<endl;
            // cout<<calcDiff(dates, schedule, d, q)<<endl;
            if(calcDiff(dates, schedule, d, q) > 0){
                // cout<<"!"<<endl;
                dates[q].insert(d);
                dates[schedule[d]].erase(d);
                schedule[d] = q;
            }
        }else{
            int d1 = mt() % D;
            int d2 = mt() % D;
            // cout<<d<<q<<endl;
            // cout<<clock()-start<<endl;
            // cout<<calcDiff(dates, schedule, d, q)<<endl;
            // cout<<"AA"<<endl;
            // cout<<calcSwap(dates, schedule, d1, d2)<<endl;
            if(calcSwap(dates, schedule, d1, d2) > 0){
                // cout<<"!"<<endl;
                dates[schedule[d1]].insert(d2);
                dates[schedule[d2]].insert(d1);
                swap(schedule[d1], schedule[d2]);
            }
        }
        end = std::chrono::system_clock::now();
    }

}


ll scoring(vector<int>& schedule){
    vector<int> lastHeld(26, 0);
    ll sat = 0;
    for(int d = 1;d <= D;d++){
        int contest = schedule[d-1];
        lastHeld[contest] = d;
        for(int i = 0;i < 26;i++){
            if(i == contest){
                sat += satis[d-1][i];
            }
            sat -= decline[i] * (d-lastHeld[i]);
        }
        // cout<<sat<<endl;
    }
    return sat;
}

ll calcSwap(vector<set<int>>& sched, vector<int>& schedule, int d1, int d2){
    ll result = 0;
    int sc_old_1 = schedule[d1];
    int sc_old_2 = schedule[d2];
    result += calcDiff(sched, schedule, d1, sc_old_2);
    sched[sc_old_2].insert(d1);
    sched[sc_old_1].erase(d1);
    schedule[d1] = sc_old_2;
    result += calcDiff(sched, schedule, d2, sc_old_1);
    sched[sc_old_2].erase(d1);
    sched[sc_old_1].insert(d1);
    schedule[d1] = sc_old_1;
    return result;

    
}

ll calcDiff(vector<set<int>>& sched, vector<int>& schedule, int d, int q){
    ll result = 0;
    // cout<<"A"<<endl;
    result -= satis[d][schedule[d]];
    result += satis[d][q];
    // cout<<"A"<<endl;
    auto lastHeldNewP = sched[q].lower_bound(d);
    // cout<<"A"<<endl;
    lastHeldNewP--;
    int lastHeldNew = *lastHeldNewP;
    int nextHeldNew = *sched[q].lower_bound(d+1);
    auto lastHeldOldP = (sched[schedule[d]].lower_bound(d));
    lastHeldOldP--;
    // cout<<"AA"<<endl;
    int lastHeldOld = *(lastHeldOldP);
    int nextHeldOld = *sched[schedule[d]].lower_bound(d+1);
    result += decline[q] * (nextHeldNew - d) * (d - lastHeldNew);
    result -= decline[schedule[d]] * (nextHeldOld - d) * (d - lastHeldOld);
    return result;
    // cout<<q<<" " <<lastHeldNew<<" "<<nextHeldNew<<" "<<d<<endl;
    // cout<<schedule[d]<<" "<<lastHeldOld<<" "<<nextHeldOld<<" "<<d<<endl;
    
    
}

ll calcDiffs(vector<int>& schedule, vector<int>& d, vector<int>& q, int M){
    vector<set<int>> sched(26,set<int>());
    for(int i = 0;i < D;i++){
        sched[schedule[i]].insert(i);
    }
    // cout<<"A"<<endl;
    for(int i = 0;i < 26;i++){
        sched[i].insert(-1);
        sched[i].insert(D);
    }
    ll result = scoring(schedule);
    // cout<<"a"<<endl;
    for(int i = 0;i < M;i++){
        result += calcDiff(sched,schedule,d[i],q[i]);
        sched[q[i]].insert(d[i]);
        sched[schedule[d[i]]].erase(d[i]);
        schedule[d[i]] = q[i];
        // cout<<result<<endl;
        // cout<<scoring(schedule)<<endl;
        
    }
    return result;
}

int main(){
    cin>>D;
    for(int i = 0;i < 26;i++){
        int c;cin>>c;
        decline[i] = c;
    }
    for(int d = 0;d < D;d++){
        for(int i  = 0;i < 26;i++){
            int s;cin>>s;
            satis[d][i] = s;
        }
    }
    start = start = std::chrono::system_clock::now();
    vector<int> schedule(D,0);
    solve_greedy(schedule);
    solve_chRand(schedule);
    // cout<<scoring(schedule)<<endl;
    for(int i = 0;i < schedule.size();i++){
        cout<<schedule[i]+1<<endl;
    }
    // scoring(schedule);
    // for(int i = 0;i < D;i++){
    //     cin>>schedule[i];schedule[i]--;
    // }
    // int M;cin>>M;
    // vector<int> d(M),q(M);
    // for(int i = 0;i < M;i++){
    //     cin>>d[i]>>q[i];
    //     d[i]--;q[i]--;
    // }
    // // cout<<"A"<<endl;
    // calcDiff(schedule, d,q,M);

}

Measured memory_bytes: 3744