The program must accept a matrix representing the month of a calender year. The size of the matrix can be 6*7 or 7*6. In 6*7 matrix, the 7 columns represent the 7 weekdays. In 7*6 matrix, the 7 rows represent the 7 weekdays. The matrix contains integers, asterisks, and hash symbols. The asterisks represent the empty spaces in the month. The hash symbols represent the holidays in the month. The program must print the holidays along with the weekday in chronological order in the given month as the output. If there is no holiday in the given month, then the program must print -1 as the output.


Note: The order of the 7 weekdays are Sun, Mon, Tue, Wed, Thu, Fri and Sat:


Input Format:

The lines containing a matrix representing the month of a calender year.


Output Format:

The lines containing the holidays along with the weekday in chronological order.


Example Input/Output 1:


Input:

* * 1 2 3 4 5

6 7 8  9 10 11 12

13 14 # 16 17 18 19

20 21 22 23 24 25 #

# # 29 30 * * *

* * * * * *  *

Output:

15 Tue

26 Sat

27 Sun

28 Mon


Example Input/Output 2:


Input:

* 3 10 17 24 31

* 4 11 18 25 *

* 5 12 19 26 *

* 6 13 20 27 *

* 7 14 21 28 *

1 8 15 22 29 *

2 9 16 23 30 *

Output;

-1


Solution: In Python


calender = [input().split() for row in range(6)]

if len(calender[0])==6:

    calender.append(input().split())

    calender = [list(row) for row in zip(*calender)]

date = 1

days = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]

hasHolidays=False

for row in range(0,6):

    for col in range(0,7):

        if calender[row][col].isdigit():

            date+=1

        elif calender[row][col]=='#':

            print(date,days[col])

            hosHolidays=True

            date+=1

if hasHolidays==False:

    print(-1)