#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 30
#define MAX_D 400

    /*
    いろいろ
    int x = rand()%100;
    double x = (double)rand()/RAND_MAX;
    mt19937 get_rand_mt;
    shuffle(vec.begin(), vec.end(), get_rand_mt);
    int dx[4] = {-1, 0, 1, 0};
    int dy[4] = {0, -1, 0, 1};
    char cc[4] = {'U','L','D','R'};
    */

int D;
int c[MAX_N];
int s[MAX_D][MAX_N];
int ma;
int ans[MAX_D];

int real_ma;
int real_ans[MAX_D];

int score[30][400];

set<int> days[26];


int calc(){
    int las[26] = {};
    int res = 0;
    rep(i,D){
        res += s[i][ans[i]];
        las[ans[i]] = i+1;
        rep(j,26){
            res -= (i + 1 - las[j]) * c[j];
        }
    }
    return res;
}

int calc2(){
    int las[26] = {};
    rep(i,D){
        score[ans[i]][i+1] += s[i][ans[i]];
        las[ans[i]] = i+1;
        rep(j,26){
            score[j][i+1] += score[j][i] - (i + 1 - las[j]) * c[j];
        }
    }

    int res = 0;
    rep(i,26)res += score[i][D];
    return res;
}

int calc_col3(int jj){
    int res = 0;
    int las = 0;
    int cjj = c[jj];
    rep(i,D){
        if(ans[i] == jj){
            res += s[i][jj];
            las = i+1;
        }
        res -= (i + 1 - las) * cjj;
    }
    return res;
}

int calc_col2(int jj){
    int las = 0;
    int cjj = c[jj];
    rep(i,D){
        score[jj][i+1] = score[jj][i];
        if(ans[i] == jj){
            score[jj][i+1] += s[i][jj];
            las = i+1;
        }
        score[jj][i+1] -= (i + 1 - las) * cjj;
    }
    return score[jj][D];
}

int calc_col(int jj){
    int res = 0;
    int las = 0;
    int cjj = c[jj];
    
    for(int x : days[jj]){
        res += s[x][jj];
        res -= (x-las) * (x-las+1) / 2 * cjj;
        las = x + 1;
    }
    res -= (D-las) * (D-las+1) / 2 * cjj;

    return res;
}

void calc_dp(int x, int y){
    int m = 0;
    rep(i,D){
        if(ans[i] == x || ans[i] == y)m++;
    }
    int dp[D+1][m+1][D+1];
    rep(i,D+1){
        rep(j,m+1){
            rep(k,D+1){
                dp[i][j][k] = -1001001001;
            }
        }
    }

    
}

int main() {
    srand((unsigned) time(NULL));
    clock_t start,end;
	start = clock();

    string fileNameIfs = "input.txt";
    const char* cstrIfs = fileNameIfs.c_str();
    ifstream ifs(cstrIfs);
    if(!ifs.is_open()){ // 標準入力する
        cin >> D;
        rep(i,26)cin >> c[i];
        rep(i,D)rep(j,26)cin >> s[i][j];
    }else{ // ファイル入力する
        ifs >> D;
        rep(i,26)ifs >> c[i];
        rep(i,D)rep(j,26)ifs >> s[i][j];
    }    
    


    int las[26] = {};
    rep(i,D){
        int max_s = -1;
        int arg = -1;
        rep(j,26){
            int tmp_score = s[i][j] + (i+1-las[j]) * c[j];
            if(tmp_score > max_s){
                max_s = tmp_score;
                arg = j;
            }
        }
        ans[i] = arg;
        las[arg] = i+1;
        real_ans[i] = ans[i];
        days[ans[i]].insert(i);
    }

    ma = calc();
    real_ma = ma;

    start = clock();
    int loop = 0;


    double start_temp = 1000;
    double end_temp = 0.1;
    while(true){
        loop++;
        


        end = clock();
        double now_time = (double)(end-start)/CLOCKS_PER_SEC;
        if(now_time > 1.9)break;

        double temp = start_temp + (end_temp - start_temp) * now_time / 1.9;
        
        if(loop%2==1){
            int x = rand()%D;
            int y = rand()%26;
            while(ans[x] == y){
                x = rand()%D;
                y = rand()%26;
            }

            int befo = calc_col(ans[x]) + calc_col(y);

            days[ans[x]].erase(x);
            days[y].insert(x);

            int keep = ans[x];
            ans[x] = y;

            int aft = calc_col(keep) + calc_col(y);

            double prob = exp((double)(aft - befo) / temp);

            if(prob > (double)rand()/RAND_MAX){
                // if(aft - befo < 0) cout << loop << ' ' << aft - befo << endl;
                ma += aft - befo;
                if(ma > real_ma){
                    real_ma = ma;
                    rep(i,D)real_ans[i] = ans[i];
                }
            }else{
                ans[x] = keep;
                days[y].erase(x);
                days[ans[x]].insert(x);
            }
        }
        
        else{
            int x = rand()%D;
            int y = rand()%D;
            while(ans[x] == ans[y]){
                x = rand()%D;
                y = rand()%D;
            }
            
            int befo = calc_col(ans[x]) + calc_col(ans[y]);

            days[ans[x]].erase(x);
            days[ans[x]].insert(y);
            days[ans[y]].erase(y);
            days[ans[y]].insert(x);
            swap(ans[x], ans[y]);

            int aft = calc_col(ans[x]) + calc_col(ans[y]);

            double prob = exp((double)(aft - befo) / temp);

            if(prob > (double)rand()/RAND_MAX){
                // if(aft - befo < 0) cout << loop << ' ' << aft - befo << endl;
                ma += aft - befo;
                if(ma > real_ma){
                    real_ma = ma;
                    rep(i,D)real_ans[i] = ans[i];
                }
            }else{
                swap(ans[x], ans[y]);
                days[ans[x]].erase(y);
                days[ans[x]].insert(x);
                days[ans[y]].erase(x);
                days[ans[y]].insert(y);
            }
        }

        
    }

    /*
    int stooop;
    cin >> stooop;
    */

    ma = real_ma;
    rep(i,D){
        ans[i] = real_ans[i];
    }

    rep(i,D){
        cout << ans[i] + 1 << endl;
    }

    string fileName = "out.txt";
    const char* cstr = fileName.c_str();
    ofstream ofs(cstr);
    rep(i,D){
        ofs << ans[i] + 1 << endl;
    }
    ofs.close();
    // cout << ma << endl;
    // cout << loop << endl;
    return 0;
}




Measured memory_bytes: 4344