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: 120ms
Memory: 21432kB
Author: 13587177532
In contest: 1087

T = int(raw_input().strip())
for case in range(T):
	y= map(int, raw_input().strip().split())
	d=1
	m=5
	w= (d+2*m+3*(m+1)/5+y[0]+y[0]/4-y[0]/100+y[0]/400) % 7
	if w==0:
		print 9
	elif w==6:
		print 6
	elif w==1:
		print 6
	else:
		print 5