Rahul's Dad is the CEO of one of the leading companies. Every time somebody seeks for an appointment he calls up his secretary and asks her whether the day is a Sunday or not. He has to keep his caller on hold and is unhappy about it. Knowing that his son Mayank knows a bit of programming he asks him to make  a program to help him find all the sundays in a given month of a specific year.

Input:
The first Line contains t an integer, the number of test cases. The next t lines contain to integers first the year and then month.
Output:
Output consists of t lines containing the dates of sundays in that particular month

Constraints :
t<100000, month ≤ 12, 2000 ≤ year ≤ 5000

Test cases updated.. You may submit now

SAMPLE INPUT
2
3 2013
5 2010

SAMPLE OUTPUT
3 10 17 24 31
2 9 16 23 30

Difficulty: EASY

Solutions:
from calendar import Calendar

t = int(input())

for n in range(1, t+1):
	a = input().split()


	out = Calendar().monthdayscalendar(int(a[1]), int(a[0]))
	output = ""
	for days in out:
		if days[6] != 0:
			output += "%s " % days[6]
	print(output)