Start: Apr, 17, 2017 10:00:00
Python程序设计基础培训第三次作业
End: Apr, 23, 2017 14:00:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 125ms
Memory: 21536kB
Author: shanzhenyu
In contest: 1087

f = [6,9,6,5,5,5,5]
tcase = int(raw_input().strip())
for case in range(tcase):  
	n = int(raw_input().strip())
	j = 2;
	for i in range(1929,n+1):
		if (i%4==0 and i%100!=0)or(i%400==0):
			j = (j+2)%7
		else:
			j = (j+1)%7
	print f[j];