import java.util.*;
import javax.lang.model.util.ElementScanner6;
class byteland
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Test Cases:");
int test_case = sc.nextInt();
int[] ns = new int[test_case];
int[] counter ={0,0,0};
for(int i=0;i<ns.length;i++)
{
System.out.println("Enter ns:");
ns[i] = sc.nextInt();
}
System.out.println("This Output is:");
for (int i = 0; i < test_case; i++) {
int present_time=ns[i];
if(present_time<=2)
counter[0]++;
else if(present_time>=3 && present_time<=8)
counter[1]++;
else if(present_time>=9 && present_time<=16)
counter[2]++;
else if(present_time>=17)
counter[0]=counter[0]+2;
else
System.out.println("Invalid inputs");
for (int j = 0; j <= 2; j++) {
System.out.print(counter[j]);
counter[j]=0;
}
System.out.println("");
}
}
}