This problem is supposed to be the second easiest one in KUPC2025. It was removed when the contest was ported to Universal Cup.
Consider a calendar that starts on Sunday and ends on Saturday. In this problem, the definition of the calendar follows the Gregorian calendar.
More precisely, the calendar for month $$$M$$$ of year $$$Y$$$ is drawn in the following way.
- First, prepare a grid with $$$7$$$ columns and sufficiently many rows. Initially, all cells are blank. We number the rows from the top as row $$$1,2,\dots$$$, and the columns from the left as column $$$1,2,\dots,7$$$.
- Next, define column $$$1$$$ to be Sunday, column $$$2$$$ to be Monday, $$$\dots$$$, and column $$$7$$$ to be Saturday.
- Next, determine the day of the week of $$$Y$$$ year, $$$M$$$ month, $$$1$$$-st day, and write $$$1$$$ in the corresponding column of row $$$1$$$.
- After that, repeat writing day $$$d$$$ of month $$$M$$$ in year $$$Y$$$ until the last day of the month.
- If day $$$d$$$ is a Sunday, write $$$d$$$ in column $$$1$$$ of the row immediately below the row where the previous day was written.
- Otherwise, write $$$d$$$ in the cell immediately to the right of the cell where the previous day was written.
The figure shows the calendar for March 2026. The weekday labels have been added only for convenience.
For the calendar of month $$$M$$$ in year $$$Y$$$, we call the following structure a calendar square.
- When we take rows $$$u$$$ through $$$d$$$ and columns $$$l$$$ through $$$r$$$, every cell contains a number.
- Here, it must hold that $$$d-u=r-l$$$.
- In this case, we call this structure a calendar square of size $$$d-u+1$$$.
For example,
- The structure consisting only of day $$$14$$$ is a calendar square of size $$$1$$$.
- The structure consisting of days $$$22,23,29,30$$$ is a calendar square of size $$$2$$$.
- The structure consisting of days $$$3,4,5,6,10,11,12,13,17,18,19,20,24,25,26,27$$$ is a calendar square of size $$$4$$$.
For the calendar squares contained in month $$$M$$$ of year $$$Y$$$, find the size of the largest one.