//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const int N = 26;
const int D = 365;

int d;

int c[N];
int s[D][N];

int last[N];
int evaluate(const vi& t){
    memset(last, 0, sizeof last);
    int ret = 0;
    FOR(i,t.size()){
        ret += s[i][t[i]];
        last[t[i]] = i+1;

        FOR(j,N){
            ret -= c[j] * (i+1 - last[j]);
        }
    }
    return ret;
}

vi gen_rand(){
    vi ret;
    FOR(i,d){
        ret.pb(irand(0, N-1));
    }
    return ret;
}

vi gen_greed(){
    vi ret;
    FOR(i,d){
        // bruteforce
        int best = -1, vbest = -OO;
        FOR(j,N){
            ret.pb(j);
            int v = evaluate(ret);
            if(v > vbest){
                vbest = v;
                best = j;
            }
            ret.pop_back();
        }

        ret.pb(best);
    }
    return ret;
}

vi mutate(vi vec){
    int num = irand(1, 1);
    FOR(i,num){
        int a = irand(0, d-1);
        int b = irand(0, N-1);
        vec[a] = b;
    }
    return vec;
}

pair<vi,vi> cross(const vi& a, const vi& b){
    vi reta, retb;
    int mid = irand(10, d-10);
    FOR(i,d){
        if(i <= mid){
            reta.pb(a[i]);
            retb.pb(b[i]);
        }else{
            reta.pb(b[i]);
            retb.pb(a[i]);
        }
    }
    return {reta, retb};
}

const int SS = 10;
const int ITER = 5000;
#define sample fksjdhfkjh
vector<pair<int, vi> >sample;

inline void sadd(const vi& v){
    sample.pb({-evaluate(v), v});
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);

    cin>>d;
    FOR(i,N)cin>>c[i];
    FOR(i,d){
    	FOR(j,N){
    		cin>>s[i][j];
    	}
    }

    vi randomer;
    FOR(i,SS){
        FOR(j,SS-i){
            randomer.pb(i);
        }
    }

    REP(i,1,1){
        sadd(gen_greed());
    }
    REP(i,2,SS){
        sadd(gen_rand());
    }
    sort(sample.begin(), sample.end());

    FOR(itr, ITER){
        // mutations
        FOR(i,2){
            sadd(mutate(sample[i].S));
        }

        // cross
        FOR(i,10){
            int a = randomer[irand(0, randomer.size()-1)];
            int b = randomer[irand(0, randomer.size()-1)];
            if(a == b)continue;
            auto res = cross(sample[a].S, sample[b].S);
            // sadd(res.F);
            // sadd(res.S);
            sadd(mutate(res.F));
            sadd(mutate(res.S));
        }
        // FOR(i,3){
        //     REP(j,i+1,3){
        //         auto res = cross(sample[i].S, sample[j].S);
        //         // sadd(res.F);
        //         // sadd(res.S);
        //         sadd(mutate(res.F));
        //         sadd(mutate(res.S));
        //     }
        // }

        // cull
        sort(sample.begin(), sample.end());
        while(sample.size() > SS){
            sample.pop_back();
        }
    }

    vi ans = sample[0].S;
    FOR(i,d){
        cout << ans[i]+1 << endl;
    }


    cerr << "final: " << evaluate(ans) << endl;

    return 0;
}


Measured memory_bytes: 3756