In the computer network of the Berland State University there are _n_ routers numbered from 1 to _n_. Some pairs of routers are connected by patch cords. Information can be transmitted over patch cords in both direction. The network is arranged in such a way that communication between any two routers (directly or through other routers) is possible. There are no cycles in the network, so there is only one path between each pair of routers over patch cords.
Unfortunately, the exact topology of the network was lost by administrators. In order to restore it, the following auxiliary information was collected.
For each patch cord _p_, directly connected to the router _i_, list of routers located behind the patch cord _p_ relatively _i_ is known. In other words, all routers path from which to the router _i_ goes through _p_ are known. So for each router _i_ there are _k__i_ lists, where _k__i_ is the number of patch cords connected to _i_.
For example, let the network consists of three routers connected in chain 1 - 2 - 3. Then:
* the router 1: for the single patch cord connected to the first router there is a single list containing two routers: 2 and 3;
* the router 2: for each of the patch cords connected to the second router there is a list: one list contains the router 1 and the other — the router 3;
* the router 3: for the single patch cord connected to the third router there is a single list containing two routers: 1 and 2.
Your task is to help administrators to restore the network topology, i. e. to identify all pairs of routers directly connected by a patch cord.
## Input
The first line contains a single integer _n_ (2 ≤ _n_ ≤ 1000) — the number of routers in the network.
The _i_\-th of the following _n_ lines contains a description of the lists for the router _i_.
The description of each list begins with the number of routers in it. Then the symbol '_:_' follows, and after that the numbers of routers from the list are given. This numbers are separated by comma. Lists are separated by symbol '_\-_'.
It is guaranteed, that for each router _i_ the total number of routers in its lists equals to _n_ - 1 and all the numbers in lists of each router are distinct. For each router _i_ lists do not contain the number _i_.
## Output
Print _\-1_ if no solution exists.
In the other case print to the first line _n_ - 1 — the total number of patch cords in the network. In each of the following _n_ - 1 lines print two integers — the routers which are directly connected by a patch cord. Information about each patch cord must be printed exactly once.
Patch cords and routers can be printed in arbitrary order.
[samples]
## Note
The first example is analyzed in the statement.
The answer to the second example is shown on the picture.
<center></center>The first router has one list, which contains all other routers. The second router has three lists: the first — the single router 4, the second — the single router 1, the third — two routers 3 and 5. The third router has one list, which contains all other routers. The fourth router also has one list, which contains all other routers. The fifth router has two lists: the first — the single router 3, the second — three routers 1, 2 and 4.
在贝利亚国立大学的计算机网络中,有 #cf_span[n] 个路由器,编号从 #cf_span[1] 到 #cf_span[n]。某些路由器对之间通过网线连接。信息可以通过网线双向传输。网络的结构保证任意两个路由器之间(直接或通过其他路由器)均可通信。网络中不存在环路,因此每对路由器之间仅存在一条通过网线的路径。
不幸的是,网络的精确拓扑结构已被管理员丢失。为了恢复它,收集了以下辅助信息:
对于每个直接连接到路由器 #cf_span[i] 的网线 #cf_span[p],已知位于该网线 #cf_span[p] 相对于 #cf_span[i] 后方的所有路由器列表。换句话说,所有从这些路由器到路由器 #cf_span[i] 的路径必须经过 #cf_span[p] 的路由器均已被记录。因此,对于每个路由器 #cf_span[i],存在 #cf_span[ki] 个列表,其中 #cf_span[ki] 是连接到 #cf_span[i] 的网线数量。
例如,假设网络由三个路由器按链状连接 #cf_span[1 - 2 - 3],则:
你的任务是帮助管理员恢复网络拓扑结构,即确定所有通过网线直接连接的路由器对。
第一行包含一个整数 #cf_span[n](#cf_span[2 ≤ n ≤ 1000])——网络中路由器的数量。
接下来的 #cf_span[n] 行中,第 #cf_span[i] 行描述了路由器 #cf_span[i] 的所有列表。
每个列表的描述以该列表中路由器的数量开头,随后是符号 '_:_',然后是列表中的路由器编号,编号之间用逗号分隔。不同列表之间用符号 '_-_' 分隔。
保证对于每个路由器 #cf_span[i],其所有列表中路由器的总数等于 #cf_span[n - 1],且每个路由器的列表中所有编号互不相同。每个路由器的列表中均不包含其自身的编号 #cf_span[i]。
如果无解,请输出 _-1_。
否则,请在第一行输出 #cf_span[n - 1] —— 网络中网线的总数。接下来的 #cf_span[n - 1] 行中,每行输出两个整数,表示通过一条网线直接连接的两个路由器。每条网线的信息必须仅输出一次。
网线和路由器的输出顺序可以任意。
## Input
第一行包含一个整数 #cf_span[n](#cf_span[2 ≤ n ≤ 1000])——网络中路由器的数量。第 #cf_span[i] 行包含路由器 #cf_span[i] 的列表描述。每个列表的描述以该列表中路由器的数量开头,随后是符号 '_:_',然后是列表中的路由器编号,编号之间用逗号分隔。不同列表之间用符号 '_-_' 分隔。保证对于每个路由器 #cf_span[i],其所有列表中路由器的总数等于 #cf_span[n - 1],且每个路由器的列表中所有编号互不相同。每个路由器的列表中均不包含其自身的编号 #cf_span[i]。
## Output
如果无解,请输出 _-1_。否则,请在第一行输出 #cf_span[n - 1] —— 网络中网线的总数。接下来的 #cf_span[n - 1] 行中,每行输出两个整数,表示通过一条网线直接连接的两个路由器。每条网线的信息必须仅输出一次。网线和路由器的输出顺序可以任意。
[samples]
## Note
第一个示例已在题面中分析。第二个示例的答案如图所示。第一个路由器有一个列表,包含所有其他路由器。第二个路由器有三个列表:第一个是单个路由器 #cf_span[4],第二个是单个路由器 #cf_span[1],第三个是两个路由器 #cf_span[3] 和 #cf_span[5]。第三个路由器有一个列表,包含所有其他路由器。第四个路由器也有一个列表,包含所有其他路由器。第五个路由器有两个列表:第一个是单个路由器 #cf_span[3],第二个是三个路由器 #cf_span[1]、#cf_span[2] 和 #cf_span[4]。
**Definitions**
Let $ n \in \mathbb{Z} $, $ 2 \leq n \leq 1000 $, be the number of routers.
Let $ G = (V, E) $ be an undirected tree with $ V = \{1, 2, \dots, n\} $.
For each router $ i \in V $, let $ \mathcal{L}_i = \{L_{i,1}, L_{i,2}, \dots, L_{i,k_i}\} $ be the collection of $ k_i $ disjoint non-empty subsets of $ V \setminus \{i\} $, such that:
- $ \bigcup_{L \in \mathcal{L}_i} L = V \setminus \{i\} $,
- The sets in $ \mathcal{L}_i $ are pairwise disjoint,
- Each $ L \in \mathcal{L}_i $ corresponds to the connected component of $ G \setminus \{i\} $ containing the neighbor of $ i $ along a specific edge incident to $ i $.
**Constraints**
1. $ G $ is a tree (connected, acyclic, $ |E| = n-1 $).
2. For each $ i \in V $, the number of sets in $ \mathcal{L}_i $ equals the degree of $ i $ in $ G $.
3. For any edge $ \{i, j\} \in E $, the set $ L \in \mathcal{L}_i $ corresponding to the component containing $ j $ is equal to the set $ L' \in \mathcal{L}_j $ corresponding to the component containing $ i $, and both are equal to the connected component of $ G \setminus \{i,j\} $ that contains $ j $ (for $ L $) and $ i $ (for $ L' $).
**Objective**
Reconstruct the edge set $ E $ of the tree $ G $, given $ \{\mathcal{L}_i\}_{i=1}^n $.
If no such tree exists, output $-1$.
Otherwise, output $ n-1 $ edges $ \{u, v\} \in E $, each exactly once.