Problem:
Problem Statement

AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.

The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.

Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.

If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).

Please schedule contests on behalf of AtCoder.
If the satisfaction at the end of day D is S, you will get a score of \max(10^6 + S, 0).
There are 50 test cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your submissions will be your score.

Constraints

D = 365

Each c_i is an integer satisfying 0\leq c_i \leq 100.

Each s_{d,i} is an integer satisfying 0\leq s_{d,i} \leq 20000.

Input

Input is given from Standard Input in the following format:

D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26}

Output

Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at day d.
Print D integers t_d to Standard Output in the following format:

t_1
t_2
\vdots
t_D

Any output that does not follow the above format may result in 0 pointsWA for that test case.

Input Generation

Each integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.

Sample Input 1

5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192

Sample Output 1

1
17
13
14
13

Note that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.

Input generator, score calculator, and visualizer

Beginner's Guide

If you don't know what to do, proceed to problem B or C.

Solution in C# (.NET Core 3.1.201) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
using System.Net.Http.Headers;
using nint=System.Int32;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		const int m=26,t=1880;
		DateTime st=DateTime.Now;
		var c=sc.Ia3("0 ","");
		var g=new int[n+1][];
		var a=new int[n+1];
		var aa=new int[n+1];
		var d=new Ll<int>.Nd[n+1];
		var h=new int[m+1];
		var ll=new Ll<int>[m+1];
		var avl=new Avl[m+1];
		long p=0;
		for(int i = 1;i<=m;i++) {
			ll[i]=new Ll<int>();
			avl[i]=new Avl();
			avl[i].Ud(0,ll[i].AddLast(0));
		}
		for(int i = 1;i<=n;i++) {
			g[i]=sc.Ia3("0 ","");
			int e=1;
			for(int j = 2;j<=m;j++) {
				if(g[i][e]<g[i][j]){e=j;}
			}
			p+=g[i][e];
			h[e]=i;
			a[i]=aa[i]=e;
			d[i]=ll[e].AddLast(i);
			avl[e].Ud(i,d[i]);
			for(int j = 1;j<=m;j++) {p-=c[j]*(i-h[j]);}
		}
		long mp=p;
		for(int i = 1;i<=m;i++) {
			avl[i].Ud(n+1,ll[i].AddLast(n+1));
		}
		Random r=new Random(1);
		while((DateTime.Now-st).TotalMilliseconds<t){
			int dd=0;
			for(int i = 1;i<=n&&(dd=(int)(DateTime.Now-st).TotalMilliseconds)<t;i++) {
				for(int j = 1;j<=m;j++) {
					if(a[i]==j){continue;}
					var e=avl[j].Ub(i);
					int cp=g[i][j]+(i-e.ll.d)*(e.ll.ne.d-i)*c[j];
					int cm=g[i][a[i]]+(i-d[i].pr.d)*(d[i].ne.d-i)*c[a[i]];
					if(cp>cm||r.Next(1000000)/1000000.0<Exp((cp-cm)/((t+10-dd)<<1))){
						ll[a[i]].Remove(d[i]);
						avl[a[i]].Dl(i);
						a[i]=j;
						d[i]=ll[j].Addnext(e.ll,i);
						avl[j].Ud(i,d[i]);
						p+=cp-cm;
						if(mp<p){
							mp=p;
							Array.Copy(a,aa,n+1);
						}
					}
				}
			}
		}
		StringBuilder sb=new StringBuilder();
		for(int i = 1;i<=n;i++) {sb.Append(aa[i]+"\n");}
		Console.Write(sb);
	}
}
public class Avl{
	public class Nd{
		public int h=1,c=1;
		public readonly nint n;
		public Ll<int>.Nd ll;
		public Nd l,r;
		public Nd(nint n,Nd du,Ll<int>.Nd ll){this.n=n;l=du;r=du;this.ll=ll;}
	}
	public Nd root,du;
	public int cnt=0;
	public Avl(){
		du=new Nd(nint.MinValue,du,null);du.h=0;du.c=0;
		root=du;
	}
	public void Ud(nint n,Ll<int>.Nd ll){
		Nd mn=new Nd(n,du,ll);
		if(root==du){root=mn;}
		else{
			Fu(root,mn);
			if(Abs(root.l.h-root.r.h)>1){root=Rotate(root);}
		}
		cnt++;
	}
	private void Fu(Nd t,Nd mn){
		t.c++;
		if(t.n>mn.n){
			if(t.l!=du){
				Fu(t.l,mn);
				if(Abs(t.l.l.h-t.l.r.h)>1){t.l=Rotate(t.l);}
			}
			else{t.l=mn;}
		}
		else{
			if(t.r!=du){
				Fu(t.r,mn);
				if(Abs(t.r.l.h-t.r.r.h)>1){t.r=Rotate(t.r);}
			}
			else{t.r=mn;}
		}
		t.h=Max(t.l.h,t.r.h)+1;
	}
	private Nd Rotate(Nd t){
		Nd nd=du;
		if(t.l.h>t.r.h){
			if(t.l.l.h>t.l.r.h){
				nd=t.l;t.l=t.l.r;nd.r=t;
				t.h=Max(t.l.h,t.r.h)+1;
				t.c=t.l.c+t.r.c+1;
			}
			else{
				nd=t.l.r;
				t.l.r=nd.l;nd.l=t.l;
				t.l.h=Max(t.l.l.h,t.l.r.h)+1;
				t.l.c=t.l.l.c+t.l.r.c+1;
				t.l=nd.r;nd.r=t;
				t.h=Max(t.l.h,t.r.h)+1;
				t.c=t.l.c+t.r.c+1;
			}
		}
		else{
			if(t.r.l.h>t.r.r.h){
				nd=t.r.l;
				t.r.l=nd.r;nd.r=t.r;
				t.r.h=Max(t.r.l.h,t.r.r.h)+1;
				t.r.c=t.r.l.c+t.r.r.c+1;
				t.r=nd.l;nd.l=t;
				t.h=Max(t.l.h,t.r.h)+1;
				t.c=t.l.c+t.r.c+1;
			}
			else{
				nd=t.r;t.r=t.r.l;nd.l=t;
				t.h=Max(t.l.h,t.r.h)+1;
				t.c=t.l.c+t.r.c+1;
			}
		}
		nd.h=Max(nd.l.h,nd.r.h)+1;
		nd.c=nd.l.c+nd.r.c+1;
		return nd;
	}
	public bool Dl(nint n){
		if(cnt==0){return false;}
		Nd t=root;
		if(t.n==n){
			root=Fd2(root);
			if(cnt==0){return true;}
			else if(Abs(root.l.h-root.r.h)>1){root=Rotate(root);}
			else{
				root.h=Max(root.l.h,root.r.h)+1;
				root.c=root.l.c+root.r.c+1;
			}
			return true;
		}
		bool bo=Fd1(root,n);
		if(Abs(root.l.h-root.r.h)>1){root=Rotate(root);}
		else{
			root.h=Max(root.l.h,root.r.h)+1;
			root.c=root.l.c+root.r.c+1;
		}
		return bo;
	}
	private bool Fd1(Nd t,nint n){
		if(t.n>n){
			if(t.l==du){return false;}
			else if(t.l.n!=n){
				bool bo=Fd1(t.l,n);
				if(Abs(t.l.l.h-t.l.r.h)>1){t.l=Rotate(t.l);}
				else{
					t.l.h=Max(t.l.l.h,t.l.r.h)+1;
					t.l.c=t.l.l.c+t.l.r.c+1;
				}
				return bo;
			}
			else{
				t.l=Fd2(t.l);
				t.h=Max(t.l.h,t.r.h)+1;
				t.c=t.l.c+t.r.c+1;
				return true;
			}
		}
		else{
			if(t.r==du){return false;}
			else if(t.r.n!=n){
				bool bo=Fd1(t.r,n);
				if(Abs(t.r.l.h-t.r.r.h)>1){t.r=Rotate(t.r);}
				else{
					t.r.h=Max(t.r.l.h,t.r.r.h)+1;
					t.r.c=t.r.l.c+t.r.r.c+1;
				}
				return bo;
			}
			else{
				t.r=Fd2(t.r);
				t.h=Max(t.l.h,t.r.h)+1;
				t.c=t.l.c+t.r.c+1;
				return true;
			}
		}
	}
	private Nd Fd2(Nd dn){
		cnt--;
		if(dn.l==du){return dn.r;}
		if(dn.r==du){return dn.l;}
		Nd u=dn.l;
		if(u.r==du){
			u.r=dn.r;
			u.h=Max(u.l.h,u.r.h)+1;
			u.c=u.l.c+u.r.c+1;
			return u;
		}
		u=Fd3(u,dn);
		if(Abs(dn.l.l.h-dn.l.r.h)>1){u.l=Rotate(dn.l);}
		else{
			dn.l.h=Max(dn.l.l.h,dn.l.r.h)+1;
			dn.l.c=dn.l.l.c+dn.l.r.c+1;
		}
		u.h=Max(u.l.h,u.r.h)+1;
		u.c=u.l.c+u.r.c+1;
		return u;
	}
	private Nd Fd3(Nd u,Nd dn){
		if(u.r.r!=du){
			Nd v=Fd3(u.r,dn);
			if(Abs(u.r.l.h-u.r.r.h)>1){u.r=Rotate(u.r);}
			else{
				u.r.h=Max(u.r.l.h,u.r.r.h)+1;
				u.r.c=u.r.l.c+u.r.r.c+1;
			}
			return v;
		}
		else{
			Nd v=u.r;u.r=u.r.l;v.l=dn.l;v.r=dn.r;
			return v;
		}
	}
	public bool Hs(nint n){
		Nd t=root;
		if(cnt==0){return false;}
		if(t.n==n){return true;}
		bool bo=false;
		while(true){
			if(t.n>n){
				if(t.l==du){break;}
				else if(t.l.n!=n){t=t.l;}
				else{bo=true;break;}
			}
			else{
				if(t.r==du){break;}
				else if(t.r.n!=n){t=t.r;}
				else{bo=true;break;}
			}
		}
		return bo;
	}
	public Nd Ra(int n){return cnt>=n&&cnt!=0?Fr(root,n):null;}
	private Nd Fr(Nd t,int n){
		if(t.l.c>n-1){return Fr(t.l,n);}
		if(t.l.c<n-1){return Fr(t.r,n-t.l.c-1);}
		return t;
	}
	public Nd Lb(nint n){return cnt!=0?Flb(root,n):null;}
	private Nd Flb(Nd t,nint n){
		if(t.n<n){
			if(t.r==du){return null;}
			return Flb(t.r,n);
		}
		if(t.n>n){
			if(t.l==du){return t;}
			Nd u=Flb(t.l,n);
			return u==null?t:u;
		}
		return t;
	}
	public Nd Ub(nint n){return cnt!=0?Fub(root,n):null;}
	private Nd Fub(Nd t,nint n){
		if(t.n>n){
			if(t.l==du){return null;}
			return Fub(t.l,n);
		}
		if(t.n<n){
			if(t.r==du){return t;}
			Nd u=Fub(t.r,n);
			return u==null?t:u;
		}
		return t;
	}
	public int Rg(nint a,nint b){return cnt!=0?Frg(root,a,b,false,false):0;}
	private int Frg(Nd t,nint a,nint b,bool l,bool r){
		if(t.h==0){return 0;}
		if(l&&r){return t.c;}
		if(t.n<a){return Frg(t.r,a,b,t.n>=a,r);}
		if(t.n>b){return Frg(t.l,a,b,l,t.n<=b);}
		return Frg(t.l,a,b,l,t.n<=b)+Frg(t.r,a,b,t.n>=a,r)+1;
	}
	public void En(Action<Nd> f){if(cnt>0){Fen(root,f);}}
	private void Fen(Nd t,Action<Nd> f){
		f(t);
		if(t.l!=du){Fen(t.l,f);}
		if(t.r!=du){Fen(t.r,f);}
	}
}
public class Ll<T>{
	public class Nd{
		public T d;
		public Nd pr,ne;
		public bool b=true;
		public Nd(T d,Nd pr,Nd ne){
			this.d=d;
			this.pr=pr;
			this.ne=ne;
		}
	}
	public Nd first=null,last=null;
	public int cnt=0;
	public Nd AddLast(T d){
		if(cnt==0){
			first=new Nd(d,null,null);
			last=first;
		}
		else{
			last.ne=new Nd(d,last,null);
			last=last.ne;
		}
		cnt++;
		return last;
	}
	public Nd Addprev(Nd t,T d){
		if(!t.b){return null;}
		t.pr=new Nd(d,t.pr,t);
		if(t!=first){t.pr.pr.ne=t.pr;}
		else{first=t.pr;}
		cnt++;
		return t.pr;
	}
	public Nd Addnext(Nd t,T d){
		if(!t.b){return null;}
		t.ne=new Nd(d,t,t.ne);
		if(t!=last){t.ne.ne.pr=t.ne;}
		else{last=t.ne;}
		cnt++;
		return t.ne;
	}
	public void Addprev(Nd t,Nd u){
		if(!t.b){return;}
		if(u.b){Remove(u);}
		u.b=true;
		u.pr=t.pr;
		u.ne=t;
		t.pr=u;
		if(t!=first){u.pr.ne=u;}
		else{first=u;}
		cnt++;
	}
	public void Addnext(Nd t,Nd u){
		if(!t.b){return;}
		if(u.b){Remove(u);}
		u.b=true;
		u.ne=t.ne;
		u.pr=t;
		t.ne=u;
		if(t!=last){u.ne.pr=u;}
		else{last=u;}
		cnt++;
	}
	public void Addprev(Nd t,Nd u,Nd v){
		if(!t.b){return;}
		if(u!=first){u.pr.ne=v.ne;}
		else{first=v.ne;}
		if(v!=last){v.ne.pr=u.pr;}
		else{last=u.pr;}
		if(t!=first){t.pr.ne=u;}
		else{first=u;}
		v.ne=t;
		u.pr=t.pr;
		t.pr=v;
	}
	public void Addnext(Nd t,Nd u,Nd v){
		if(!t.b){return;}
		if(u!=first){u.pr.ne=v.ne;}
		else{first=v.ne;}
		if(v!=last){v.ne.pr=u.pr;}
		else{last=u.pr;}
		if(t!=last){t.ne.pr=v;}
		else{last=v;}
		v.ne=t.ne;
		u.pr=t;
		t.ne=u;
	}
	public void Remove(Nd t){
		if(cnt==1){
			first=null;
			last=null;
		}
		else if(t==first){
			first=t.ne;
			first.pr=null;
		}
		else if(t==last){
			last=t.pr;
			last.ne=null;
		}
		else{
			t.pr.ne=t.ne;
			t.ne.pr=t.pr;
		}
		t.b=false;
		cnt--;
	}
	public void Swap(Nd t1,Nd t2){
		if(t1==t2||!t1.b||!t2.b){return;}
		if(t1.ne==t2){
			if(t1!=first){t1.pr.ne=t2;}
			else{first=t2;}
			t2.pr=t1.pr;
			if(t2!=last){t2.ne.pr=t1;}
			else{last=t1;}
			t1.ne=t2.ne;
			t1.pr=t2;
			t2.ne=t1;
		}
		else if(t2.ne==t1){
			if(t2!=first){t2.pr.ne=t1;}
			else{first=t1;}
			t1.pr=t2.pr;
			if(t1!=last){t1.ne.pr=t2;}
			else{last=t2;}
			t2.ne=t1.ne;
			t2.pr=t1;
			t1.ne=t2;
		}
		else{
			var pr=t1.pr;
			var ne=t1.ne;
			t1.pr=t2.pr;
			t1.ne=t2.ne;
			if(t1.pr!=null){t1.pr.ne=t1;}
			else{first=t1;}
			if(t1.ne!=null){t1.ne.pr=t1;}
			else{last=t1;}
			t2.pr=pr;
			t2.ne=ne;
			if(pr!=null){pr.ne=t2;}
			else{first=t2;}
			if(ne!=null){ne.pr=t2;}
			else{last=t2;}
		}
	}
	public void Ma(Action<Nd> f){
		var t=first;
		while(t!=null){
			f(t);
			t=t.ne;
		}
	}
	public void Ma(Nd e,Nd z,Action<Nd> f){
		var t=e;
		z=z.ne;
		while(t!=z){
			f(t);
			t=t.ne;
		}
	}
	public void Md(Nd e,Nd z,Action<Nd> f){
		var t=e;
		z=z.ne;
		while(t!=z){
			f(t);
			t.b=false;
			cnt--;
			t=t.ne;
		}
		if(e!=first){
			e.pr.ne=z;
			if(z!=null){z.pr=e.pr;}
			else{last=e.pr;}
		}
		else{
			first=z;
			if(z!=null){first.pr=null;}
			else{last=null;}
		}
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}
public class Sct{
	private StreamReader sr;
	public Sct(string t){sr=new StreamReader(t);}
	public int I{get{return int.Parse(sr.ReadLine());}}
	public long L{get{return long.Parse(sr.ReadLine());}}
	public double D{get{return double.Parse(sr.ReadLine());}}
	public string S{get{return sr.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(sr.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(sr.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(sr.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return sr.ReadLine().Split();}}
	public object[] Oa{get{return sr.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+sr.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+sr.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+sr.ReadLine()+b).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+sr.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+sr.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+sr.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(sr.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,sr.ReadLine().Split());}return a;}
}