import calendar as c while 1:print('%-20s'+'\n%s'*7)%tuple(c.TextCalendar(6).formatmonth(*map(int,raw_input().split())[::-1]).split('\n')[:8])