logo AlgoBeat OnlineJudge
登录 注册

#206233. [NWRRC 2013] Kids in a Friendly Class

内存限制:256 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Kevin resembles his class in primary school. There were girls and boys in his class. Some of them were friends, some were not. But if one person considered another person a friend, the opposite was also true.

Interestingly, every girl had exactly a friends among girls and exactly friends among boys, whereas every boy had exactly friends among girls and exactly friends among boys.

Kevin does not remember the size of his class. Help him reconstruct the class with minimal possible number of kids, such that the above conditions are satisfied.

输入格式

The only line contains four integers , and .

输出格式

Output an example of a class of minimal possible size satisfying the above conditions.

The first line should contains two positive integers: -- the number of girls, and -- the number of boys.

Let's assign numbers through to the girls and through to the boys.

Each of the next lines should contain a pair of distinct integers describing a pair of friends by their numbers. Each pair of friends should appear exactly once in this list.

样例

样例输入 1

1 2 1 2

样例输出 1

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

数据范围与提示

Time limit: 2 s, Memory limit: 256 MB.