Олимпиадный тренинг

Задача 38496. Circle schedule


Задача

Темы:
Volodya really liked the problems of the Olympiad in Informatics, so he decided to go to classes in the programming circle. When he came to the first lesson of the circle, he learned that the classes would be held weekly on the same day of the week. Help Volodya make a calendar of classes until the end of the year – set the dates for all classes, from the first class to the end of the year.
The program receives as input two numbers written in different lines: the number of the month and the number of the day of the month when the first lesson takes place. The month number can be one of four possible numbers – 9, 10, 11, 12. Number of the day of the month – a number from 1 to 30 for September and November (months with numbers 9 and 11) or from 1 to 31 for October and December (months with numbers
10 and 12). 
The program should display the dates of all club classes until the end of the year in chronological order, one date per line, first the month, then the day of the month, separated by a space. Classes are held weekly, on the same day of the week as the first session. The format of outputting dates is the same as in the condition. Consider that there are no holidays, and the last lesson can take place on any day of December, including the 31st.
 
Examples
# Input Output
1 11
20
11 20
11 27
12 4
12 11
12 18
12 25