牛刀小试


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 64K

Problem types
Allowed languages
C, C++, Java, Python

Description

现有4个矩形,请再用另一个矩形E将这4个矩形封装起来,使得这4个矩形没有重叠,求矩形E的最小面积。

Input

第一行为T,表明测试数据的组数。接下来每组测试数据用4行描述,每行为Wi ,Hi(1<=Wi,Hi<=50),分别确定了第i个矩形的的宽高。

Output

对应每组数据的第一行是矩形E的最小面积,接下来P行每行两这个整数Ai,Bi描述了矩形E的宽高。如果有多组满Ai,Bi足条件,请按照Ai的升序进行输出。

Sample

Input

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

Output

40
4 10
5 8
4
1 4
2 2

Comments

There are no comments at the moment.