#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

struct Edge{
    int u, v;
    long long cap, cost;
 
    Edge(int _u, int _v, long long _cap, long long _cost){
        u = _u; v = _v; cap = _cap; cost = _cost;
    }
};
 
struct MinCostFlow{
    int n, s, t;
    long long flow, cost;
    vector<vector<int> > graph;
    vector<Edge> e;
    vector<long long> dist, potential;
    vector<int> parent;
    bool negativeCost;
 
    MinCostFlow(int _n){
        // 0-based indexing
        n = _n;
        graph.assign(n, vector<int> ());
        negativeCost = false;
    }
 
    void addEdge(int u, int v, long long cap, long long cost, bool directed = true){
        if(cost < 0)
            negativeCost = true;
 
        graph[u].push_back(e.size());
        e.push_back(Edge(u, v, cap, cost));
 
        graph[v].push_back(e.size());
        e.push_back(Edge(v, u, 0, -cost));
 
        if(!directed)
            addEdge(v, u, cap, cost, true);
    }
 
    pair<long long, long long> getMinCostFlow(int _s, int _t){
        s = _s; t = _t;
        flow = 0, cost = 0;
 
        potential.assign(n, 0);
        if(negativeCost){
            // run Bellman-Ford to find starting potential
            dist.assign(n, 1LL<<62);
            for(int i = 0, relax = false; i < n && relax; i++, relax = false){
                for(int u = 0; u < n; u++){
                    for(int k = 0; k < graph[u].size(); k++){
                        int eIdx = graph[u][i];
                        int v = e[eIdx].v; ll cap = e[eIdx].cap, w = e[eIdx].cost;
 
                        if(dist[v] > dist[u] + w && cap > 0){
                            dist[v] = dist[u] + w;
                            relax = true;
            }   }   }   }
 
            for(int i = 0; i < n; i++){
                if(dist[i] < (1LL<<62)){
                    potential[i] = dist[i];
        }   }   }
 
        while(dijkstra()){
            flow += sendFlow(t, 1LL<<62);
        }
 
        return make_pair(flow, cost);
    }
 
    bool dijkstra(){
        parent.assign(n, -1);
        dist.assign(n, 1LL<<62);
        priority_queue<ii, vector<ii>, greater<ii> > pq;
 
        dist[s] = 0;
        pq.push(ii(0, s));
 
 
        while(!pq.empty()){
            int u = pq.top().second;
            long long d = pq.top().first;
            pq.pop();
 
            if(d != dist[u]) continue;
 
            for(int i = 0; i < graph[u].size(); i++){
                int eIdx = graph[u][i];
                int v = e[eIdx].v; ll cap = e[eIdx].cap;
                ll w = e[eIdx].cost + potential[u] - potential[v];
 
                if(dist[u] + w < dist[v] && cap > 0){
                    dist[v] = dist[u] + w;
                    parent[v] = eIdx;
 
                    pq.push(ii(dist[v], v));
        }   }   }
 
        // update potential
        for(int i = 0; i < n; i++){
            if(dist[i] < (1LL<<62))
                potential[i] += dist[i];
        }
 
        return dist[t] != (1LL<<62);
    }
 
    long long sendFlow(int v, long long curFlow){
        if(parent[v] == -1)
            return curFlow;
        int eIdx = parent[v];
        int u = e[eIdx].u; ll w = e[eIdx].cost;
 
        long long f = sendFlow(u, min(curFlow, e[eIdx].cap));
 
        cost += f*w;
        e[eIdx].cap -= f;
        e[eIdx^1].cap += f;
 
        return f;
    }
};

const int C = 26;
const int N = 365;
ll a[N+10][C+10];
ll c[C+10];

ll getScore(vi &ans)
{
	ll satisfaction = 0;
	vi las(C+1,-1);
	for(int i=0;i<ans.size();i++)
	{
		satisfaction += a[i][ans[i]];
		las[ans[i]]=i;
		for(int j=0;j<C;j++)
		{
			satisfaction-=c[j]*(i-las[j]);
		}
	}
	return max(0LL, ll(1e6)+satisfaction);
}

ll s2(ll r)
{
	return (r*(r+1))/2;
}

ll s2(ll l, ll r) //sum of l to r
{
	if(l>r) return 0;
	if(l==0) return s2(r);
	return s2(r)-s2(l-1);
}

ll solve(vi &ans, int l, int r)
{
	MinCostFlow mcmf(2*C+10);
	vi las(C,-1);
	int lascnt=0;
	for(int i=l-1;i>=0;i--)
	{
		if(las[ans[i]]<0)
		{
			lascnt++;
			las[ans[i]]=i;
		}
		if(lascnt>=C) break;
	}
	int s = 2*C+9; int e = 2*C+8;
	for(int i=l;i<=r;i++)
	{
		for(int j=0;j<26;j++)
		{
			mcmf.addEdge(j,i-l+26,1,-(a[i][j]-c[j]*(s2(l-las[j],i-1-las[j])+s2(r-i))));
		}
	}
	int trash = 2*C+7;
	for(int j=0;j<26;j++)
	{
		mcmf.addEdge(s,j,1,0);
		mcmf.addEdge(j,trash,1,c[j]*(s2(l-las[j],r-las[j])));
	}
	mcmf.addEdge(trash,e,C-(r-l+1),0);
	for(int i=l;i<=r;i++)
	{
		mcmf.addEdge(i-l+26,e,1,0);
	}
	auto tmp = mcmf.getMinCostFlow(s,e);
	//cerr<<"FLOW SIZE = "<<tmp.fi<<'\n';
	//cerr<<"FLOW COST = "<<-tmp.se<<'\n';
	for(int i=0;i<C;i++)
	{
		for(auto id:mcmf.graph[i])
		{
			auto e = mcmf.e[id];
			if(e.v>=26&&e.v<=r-l+26&&e.cap==0)
			{
				assert(ans[e.v-26+l]<0);
				ans[e.v-26+l]=i;
			}
		}
	}
	return -tmp.se;
}

void print(const vi &ans)
{
	for(int i=0;i<ans.size();i++)
	{
		assert(ans[i]>=0);
		cout<<ans[i]+1<<'\n';
	}
}

const bool DEBUG = 0;
int n; 

void read()
{
	cin>>n;
	for(int i=0;i<C;i++) cin>>c[i];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<C;j++)
		{
			cin>>a[i][j];
		}
	}
}

ll solve_run()
{
	vi ans(n,-1);
	int l = 0;
	const int D = 8;
	while(l<n)
	{
		ld bestavg = -ld(1e18);
		int bestr = l;
		if(l+D<n)
		{
			for(int r=l+D;r<min(n,l+C);r++)
			{
				ll tmp = solve(ans,l,r);
				ld avg = ld(tmp)/ld(r-l+1);
				if(avg>bestavg)
				{
					bestavg=avg; bestr=r;
				}
				for(int j=l;j<=r;j++) ans[j]=-1;
			}
		}
		else
		{
			for(int r=l;r<min(n,l+C);r++)
			{
				ll tmp = solve(ans,l,r);
				ld avg = ld(tmp)/ld(r-l+1);
				if(avg>bestavg)
				{
					bestavg=avg; bestr=r;
				}
				for(int j=l;j<=r;j++) ans[j]=-1;
			}
		}
		solve(ans,l,bestr);
		l=bestr+1;
	}
	if(!DEBUG)
	{
		print(ans);
	}
	return getScore(ans);
}

void genCase()
{
	n=365;
	for(int i=0;i<26;i++) c[i]=rand()%101;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<26;j++)
		{
			a[i][j]=rand()%20001;
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	srand(time(NULL));
	if(!DEBUG)
	{
		read();
		solve_run();
		return 0;
	}
	const int C = 50;
	ll sum = 0;
	for(int cc=1;cc<=C;cc++)
	{
		genCase();
		sum+=solve_run();
		cerr<<"Case "<<cc<<" complete. Total score = "<<sum<<", Average score = "<<fixed<<setprecision(5)<<ld(sum)/ld(cc)<<'\n';
	}
}



Measured memory_bytes: 3880