# Arup Guha
# 10/2/2020
# Solution to 2930 Program 5B: Groundhog Month Calendar

# Get the user input.
num_months = int(input("How many months are there on the Groundhog calendar?\n"))
days_per_month = int(input("How many days per month are there on the Groundhog calendar?\n"))

# Outer loop runs through months.
for month in range(1, num_months+1):

    # Month header
    print("Month",month)
    print("S\tM\tT\tW\tR\tF\tS\t")

    # Loop through each day,
    for i in range(1, days_per_month+1):

        # First, just print the number and tab.
        print(str(i)+"\t", end="")

        # We advance to the new line after every multiple of 7.
        if i%7 == 0:
            print()

    # Blank line between months.
    print()
