zoj 2659

来源:互联网 发布:在淘宝上能买到警服吗 编辑:程序博客网 时间:2024/06/14 08:30

Box


Time Limit: 1 Second      Memory Limit: 32768 KB


Ivan works at a factory that produces heavy machinery. He has a simple job --- he knocks up wooden boxes of different sizes to pack machinery for delivery to the customers. Each box is a rectangular parallelepiped. Ivan uses six rectangular wooden pallets to make a box. Each pallet is used for one side of the box.

Joe delivers pallets for Ivan. Joe is not very smart and often makes mistakes --- he brings Ivan pallets that do not fit together to make a box. But Joe does not trust Ivan. It always takes a lot of time to explain Joe that he has made a mistake.

Fortunately, Joe adores everything related to computers and sincerely believes that computers never make mistakes. Ivan has decided to use this for his own advantage. Ivan asks you to write a program that given sizes of six rectangular pallets tells whether it is possible to make a box out of them.

Input

There are several test cases in the input. Each case consists of six lines. Each line describes one pallet and contains two integer numbers w and h (1 ≤ w, h ≤ 10 000) --- width and height of the pallet in millimeters respectively.

Output

Write a single word "POSSIBLE" to the output file if it is possible to make a box using six given pallets for its sides. Write a single word "IMPOSSIBLE" if it is not possible to do so.

Sample Input

1345 2584
2584 683
2584 1345
683 1345
683 1345
2584 683
1234 4567
1234 4567
4567 4321
4322 4567
4321 1234
4321 1234

Sample Output

POSSIBLE
IMPOSSIBLE

 

水平实在太低了。六块矩形组成一个立方体,那么这六块矩形有以下几个特点:

1)存在大于3种不同的矩形,不能组成立方体。

2)存在等于3种不同的矩形,每种矩形有两块,则可以为立方体。

3)存在2种不同的矩形,其中一种要为正方形(2块),另外一个矩形的边与正方形的边相同(4块)。

4)存在一种矩形,其中每条边相等。

存在更好的思路进行改进吧。学习学习。

 

 

 

以下是测试数据:

 

1345 2584
2584 683
2584 1345
683 1345
683 1345
2584 683

1234 4567
1234 4567
4567 4321
4322 4567
4321 1234
4321 1234

1345 2584
2584 683
2584 1345
2584 1345
4567 4321
4322 4567

1345 2584
2584 683
2584 1345
2584 1345
4322 4567
4322 4567


12 13
12 11
11 12
13 12
11 13
11 12


12 13
12 11
11 12
13 12
11 13
11 13

11 13
11 13
11 13
11 13
11 13
11 13

11 13
11 13
11 13
11 13
11 13
13 13

11 13
11 13
11 13
11 13
13 13
13 13

11 13
11 13
13 11
13 13
13 13
13 13

11 13
11 13
13 13
13 13
13 13
13 13

11 13
13 13
13 13
13 13
13 13
13 13