Ivan works at a factory that produces heavy machinery. He hasa simple job -- he knocks up wooden boxes of different sizesto pack machinery for delivery to the customers. Each boxis a rectangular parallelepiped. Ivan uses six rectangular wooden palletsto make a box. Each pallet is used for one side of the box.
![\epsfbox{p3214.eps}](https://i-blog.csdnimg.cn/blog_migrate/bc272781bcac28f436403599459f19f2.jpeg)
Input
Input file contains several test cases. Each of them consists of six lines. Each line describes one pallet andcontains two integer numbers w and h ( 1![$ \le$](https://i-blog.csdnimg.cn/blog_migrate/69e7d0088d6fcbc5a54cf40b70e103b0.png)
![$ \le$](https://i-blog.csdnimg.cn/blog_migrate/69e7d0088d6fcbc5a54cf40b70e103b0.png)
Output
For each test case, print one output line. Write a single word ` POSSIBLE' to the output file if it is possibleto 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
#include"cstdio"
#include"iostream"
#include"cstring"
#include"cstdlib"
#include <algorithm>
using namespace std;
int box[6][2];
int x[3][2];
int pd[6];
int main()
{
while(cin >> box[0][0] >> box[0][1]){
for(int i=1;i<6;i++)
cin >> box[i][0] >> box[i][1];
for(int i=0;i<6;i++){
if(box[i][0]>box[i][1]){
int t=box[i][0];
box[i][0]=box[i][1];
box[i][1]=t;
}
}
int k=0;
memset(x,0,sizeof(x));
for(int i=0;i<5;i++)
for(int j=i+1;j<6;j++){
if(box[i][0]==box[j][0]&&box[i][1]==box[j][1]&&box[i][0]){
x[k][0]=box[i][0],x[k++][1]=box[i][1];
box[j][0]=box[j][1]=box[i][1]=box[i][0]=0;
}
}
k=0;
memset(pd,0,sizeof(pd));
for(int i=0;i<3;i++)
for(int j=0;j<2;j++)
pd[k++]=x[i][j];
sort(pd,pd+6);
if(pd[0]==0)
printf("IMPOSSIBLE\n");
else if(pd[0]==pd[1]&&pd[2]==pd[3]&&pd[4]==pd[5])
printf("POSSIBLE\n");
else
printf("IMPOSSIBLE\n");
memset(box,0,sizeof(box));
}
return 0;
}