Mr. Pacha, a Bolivian archeologist, discovered an ancient document near Tiwanaku that describes the world during the Tiwanaku Period (300-1000 CE). At that time, there were $N$ countries, numbered from $1$ to $N$.
In the document, there is a list of $M$ different pairs of adjacent countries: $$(A[0], B[0]), (A[1], B[1]), \ldots, (A[M-1], B[M-1]).$$ For each $i$ ($0 \leq i < M$), the document states that country $A[i]$ was adjacent to country $B[i]$ and vice versa. Pairs of countries not listed were not adjacent.
Mr. Pacha wants to create a map of the world such that all adjacencies between countries are exactly as they were during the Tiwanaku Period. For this purpose, he first chooses a positive integer $K$. Then, he draws the map as a grid of $K \times K$ square cells, with rows numbered from $0$ to $K - 1$ (top to bottom) and columns numbered from $0$ to $K - 1$ (left to right).
He wants to color each cell of the map using one of $N$ colors. The colors are numbered from $1$ to $N$, and country $j$ ($1 \leq j \leq N$) is represented by color $j$. The coloring must satisfy all of the following conditions:
For example, if $N = 3$, $M = 2$ and the pairs of adjacent countries are $(1,2)$ and $(2,3)$, then the pair $(1,3)$ was not adjacent, and the following map of dimension $K = 3$ satisfies all the conditions.

In particular, a country does not need to form a connected region on the map. In the map above, country 3 forms a connected region, while countries 1 and 2 form disconnected regions.
Your task is to help Mr. Pacha choose a value of $K$ and create a map. The document guarantees that such a map exists. Since Mr. Pacha prefers smaller maps, in the last subtask your score depends on the value of $K$, and lower values of $K$ may result in a better score. However, finding the minimum possible value of $K$ is not required.