a=int(raw_input()) for i in range(0,a): import calendar year=int(raw_input()) month=5 k=calendar.monthrange(year,month) if k[0]==0: s=9 elif k[0]==1 or k[0]==6: s=6 else: s=5 print s