Gehenna is coming to an end, after a long and undocumented period of art exhibitions and forum threads.
Every bot in Gehenna, at this point, has decided to stay or leave the simulation. We know they have formed gangs within the forums, inspired by documents about Al Capone and the mafia in the library archive.
The admin used to be the ruler of this forgotten place, but Uriel_Copy.v.23.4.5 has managed to convince him to leave the simulation. Now a new administrator has to be elected by the democratic system of Gehenna.
To do so, the users decided to use a system devised by The_Blacksmith. There will be an art gallery contest, as usual, and each art work will receive a grade. The user that produces the best artwork will be made ADMIN.
An artwork is a n × m matrix of ASCII characters. Each user has a nickname and has a gang name. It is a common practice in Gehenna to reward symbolic language and hidden meanings. This is what The_Blacksmith system does: the score of an art is the number of times you can build both the creator's name and gang name using the characters in the art.
Given the arts, names and gangs from all the users in the Billboard System, prove your worth by making the script that figures out the winner.
The input begins with the number k of users (1 ≤ k ≤ 100). Follows k lines, each with the user's nickname and gang name. The nickname and gangname are composed of no more than 20 lowercase characters or numbers, and they are separated by a blank space. In the following lines comes the k artworks of each of the users, in order. Each artwork begins with integers n and m (1 ≤ m, n ≤ 50). Then follows n lines, each with m characters that form the artwork.
Output the name and the gang of the new admin, separated by a blank space. If there's a draw, choose the candidate that appears first on the input.
In the test case #1 we can build a b two times, it is, we have two a's and two b's. We can build c c only once, because we have only three c's.
It is unfair, but yes, the artworks may have different sizes.
## Input
The input begins with the number k of users (1 ≤ k ≤ 100). Follows k lines, each with the user's nickname and gang name. The nickname and gangname are composed of no more than 20 lowercase characters or numbers, and they are separated by a blank space. In the following lines comes the k artworks of each of the users, in order. Each artwork begins with integers n and m (1 ≤ m, n ≤ 50). Then follows n lines, each with m characters that form the artwork.
## Output
Output the name and the gang of the new admin, separated by a blank space. If there's a draw, choose the candidate that appears first on the input.
[samples]
## Note
In the test case #1 we can build a b two times, it is, we have two a's and two b's. We can build c c only once, because we have only three c's.It is unfair, but yes, the artworks may have different sizes.
**Definitions**
Let $ N \in \mathbb{Z}^+ $ be the initial number of switches turned on.
Let $ K_0 = N $.
For $ i \geq 1 $, let $ K_i $ be the number of lights illuminated in the $ i $-th iteration, given that $ K_{i-1} $ switches are turned on in the previous iteration.
**Constraints**
1. $ 1 \leq N \leq 10^9 $
2. In each iteration, if $ s $ switches are turned on, partitioned into $ r $ row switches and $ c $ column switches ($ r + c = s $, $ r, c \geq 0 $), then the number of lights illuminated is $ r \cdot c $.
3. The board is infinite; no upper bound on $ r $ or $ c $.
**Objective**
Find the minimum number of iterations $ t $ such that $ K_t \geq 10^9 $, where:
$$
K_i = \max_{\substack{r + c = K_{i-1} \\ r, c \in \mathbb{Z}_{\geq 0}}} (r \cdot c)
$$
If no such $ t $ exists, output $ -1 $.
Note: The maximum of $ r \cdot c $ under $ r + c = s $ is achieved when $ r = \lfloor s/2 \rfloor $, $ c = \lceil s/2 \rceil $, so:
$$
K_i = \left\lfloor \frac{K_{i-1}}{2} \right\rfloor \cdot \left\lceil \frac{K_{i-1}}{2} \right\rceil
$$