Colored Rooks

题意翻译

# 题目描述 ### ~~先 原意翻译 懒得看的直接看分割线下面的~~ $Ivan$ 是一个新画家。他有不同颜色的 $n$ 种染料。他也清楚地知道 $m$ 对颜色相互协调。 $Ivan$ 也喜欢下**象棋**。他有 5000 个车 (**象棋中的车**),他想取 k 个,分别画上颜色,并放在一个 $10^{9} \times 10^{9}$ 的棋盘上。 我们定义:如果一种颜色中的存在车,**通过行列移动,可以到达另一颜色的其他车** ( 假如可以穿过其他棋子 不受阻挡 —— 换句话说,棋子可以到它竖直和水平方向上的任何位置 ),那么它们是**相互连通**的。 $Ivan$ 希望他的棋子能如下摆放: - 对于任意颜色,都有该种颜色的车在棋盘上; - 对于任意颜色,同一颜色的车都是间接或直接连通的; - 对于任意两种不同的颜色 $a\,, b$,当且仅当这两种颜色彼此协调时,$a$ 颜色棋子与 $b$ 颜色棋子才能相互连通。 请帮助 $Ivan$ 找到这样的摆放方式。 ---------------------------------------------------- -- ## 简洁题意: 给你 $n$ 种颜色 、$m$ 个颜色**互相协调**的关系。两种颜色互相协调就是这两种颜色的车,**可以在同一行、在同一列**。颜色不协调的车就**不能在同一行、不能在同一列**。 ---------------------------------------------------- -- ~~来自 十分地弱鸡(一个英语不及格的人)的翻译。翻译的不好见谅~~ # 输入输出 输入两个整数 :$n\,,m$ $(1 \le n \le 100,0 \le m \le min(1000, \frac{n(n - 1)}{2}))$ 分别是颜色的数量 $n$ ,和 $m$ 对颜色协调关系 输出 $n$ 组数, 第 $i$ 组数的第一行为该颜色序号 $a_{i}$ , 在接下来的 $a_{i}$ 行输出车的坐标 $x$ 和 $y$ $(1 \le x,y \le 10^{9})$

题目描述

Ivan is a novice painter. He has $ n $ dyes of different colors. He also knows exactly $ m $ pairs of colors which harmonize with each other. Ivan also enjoy playing chess. He has $ 5000 $ rooks. He wants to take $ k $ rooks, paint each of them in one of $ n $ colors and then place this $ k $ rooks on a chessboard of size $ 10^{9} \times 10^{9} $ . Let's call the set of rooks on the board connected if from any rook we can get to any other rook in this set moving only through cells with rooks from this set. Assume that rooks can jump over other rooks, in other words a rook can go to any cell which shares vertical and to any cell which shares horizontal. Ivan wants his arrangement of rooks to have following properties: - For any color there is a rook of this color on a board; - For any color the set of rooks of this color is connected; - For any two different colors $ a $ $ b $ union of set of rooks of color $ a $ and set of rooks of color $ b $ is connected if and only if this two colors harmonize with each other. Please help Ivan find such an arrangement.

输入输出格式

输入格式


The first line of input contains $ 2 $ integers $ n $ , $ m $ ( $ 1 \le n \le 100 $ , $ 0 \le m \le min(1000, \,\, \frac{n(n-1)}{2}) $ ) — number of colors and number of pairs of colors which harmonize with each other. In next $ m $ lines pairs of colors which harmonize with each other are listed. Colors are numbered from $ 1 $ to $ n $ . It is guaranteed that no pair occurs twice in this list.

输出格式


Print $ n $ blocks, $ i $ -th of them describes rooks of $ i $ -th color. In the first line of block print one number $ a_{i} $ ( $ 1 \le a_{i} \le 5000 $ ) — number of rooks of color $ i $ . In each of next $ a_{i} $ lines print two integers $ x $ and $ y $ ( $ 1 \le x, \,\, y \le 10^{9} $ ) — coordinates of the next rook. All rooks must be on different cells. Total number of rooks must not exceed $ 5000 $ . It is guaranteed that the solution exists.

输入输出样例

输入样例 #1

3 2
1 2
2 3

输出样例 #1

2
3 4
1 4
4
1 2
2 2
2 4
5 4
1
5 1

输入样例 #2

3 3
1 2
2 3
3 1

输出样例 #2

1
1 1
1
1 2
1
1 3

输入样例 #3

3 1
1 3

输出样例 #3

1
1 1
1
2 2
1
3 1

说明

Rooks arrangements for all three examples (red is color $ 1 $ , green is color $ 2 $ and blue is color $ 3 $ ). ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1068C/d5a71529d7c75b3fe90cec66590a247efe39ded1.png) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1068C/b5e2c198dd08597339a7d24496646c3bd24c73c8.png) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1068C/50d31f17764396607f064d2853878860c84e17d0.png)