#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 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 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;
    }

    ma = calc();

    start = clock();
    int loop = 0;

    /*
    while(true){
        loop++;
        int x = rand()%D;
        int y = rand()%26;

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

        int tmp = calc();

        if(tmp >= ma){
            if(tmp > ma){
                // cout << loop << ' ' << tmp << endl;
            }
            ma = tmp;
        }else{
            ans[x] = keep;
        }

        end = clock();
        if((double)(end-start)/CLOCKS_PER_SEC > 0.1)break;
    }

    while(true){
        loop++;
        int x = rand()%(D-10);
        int y = rand()%10+1;

        swap(ans[x], ans[x+y]);

        int tmp = calc();

        if(tmp >= ma){
            if(tmp > ma){
                // cout << loop << ' ' << tmp << endl;
            }
            ma = tmp;
        }else{
            swap(ans[x], ans[x+y]);
        }

        end = clock();
        if((double)(end-start)/CLOCKS_PER_SEC > 0.1)break;
    }
    */

    while(true){
        loop++;
        if(loop%2 == 0){
            int x = rand()%D;
            int y = rand()%26;

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

            int tmp = calc();

            if(tmp >= ma){
                if(tmp > ma){
                    // cout << 111 << ' ' << loop << ' ' << tmp << endl;
                }
                ma = tmp;
            }else{
                ans[x] = keep;
            }
        }else{
            int x = rand()%(D-10);
            int y = rand()%10+1;

            swap(ans[x], ans[x+y]);

            int tmp = calc();

            if(tmp >= ma){
                if(tmp > ma){
                    // cout << 222 << ' ' << loop << ' ' << tmp << endl;
                }
                ma = tmp;
            }else{
                swap(ans[x], ans[x+y]);
            }
        }

            

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

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

    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: 3716