Maggie discovers a large magical crystal deep within the cave. The crystal has a regular hexagonal shape, which is seen as a symbol of balance. In this world, there are $$$999$$$ types of magic particles. When these particles are arranged in a hexagonal pattern, a crystal is formed. However, if a crystal contains more than one type of particle, it is considered impure and may explode if someone attempts to release its power.
Maggie decides to extract a pure crystal, where all the magic particles are of the same type. For each potential center of the new crystal, help Maggie determine the side length of the largest pure crystal that can be extracted.
![]() | ![]() | ![]() |
| Side length: 1. | Side length: 2. | Not a crystal. |
The first line of the input contains a single integer $$$N$$$ — the side length of the crystal.
The following $$$2N - 1$$$ lines contain the description of the crystal. Each line contains multiple integers $$$a_{r,c}$$$ — the type of the magic particle at the corresponding position.
For each position $$$(r, c)$$$ as the center, output the side length of the largest pure crystal.
Arrange the output in the same format as the given input, and do not output any leading and trailing spaces.
21 11 1 11 1
1 1 1 2 1 1 1
32 1 22 1 2 12 1 1 1 11 1 1 11 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1
52 8 1 6 28 8 8 1 4 18 8 8 8 4 9 18 8 8 8 8 2 2 38 7 7 8 8 8 2 2 9997 7 7 8 8 8 2 27 7 8 8 8 2 28 8 8 8 2 28 8 8 2 2
1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1