思路:水
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#define INF 0x3f3f3f3f
#define esp 1e-9
typedef long long LL;
using namespace std;
int T,a[4],b[4],cas=1;
bool slove()
{
for(int i=0;i<4;i++)
{
bool flag=1;
for(int j=0;j<4;j++) if(a[(j+8)%4]!=b[(i+j+8)%4]) flag=0;
if(flag) return 1;
//flag=1;
//for(int j=0;j<4;j++) if(a[(j+8)%4]!=b[(i-j+8)%4]) flag=0;
//if(flag) return 1;
}
return 0;
}
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
scanf("%d",&T);
while(T--)
{
scanf("%d%d%d%d",a+0,a+1,a+3,a+2);
scanf("%d%d%d%d",b+0,b+1,b+3,b+2);
printf("Case #%d: %s\n",cas++,slove()?"POSSIBLE":"IMPOSSIBLE");
}
return 0;
}