#include #include #include #include #include #include #include #include #include #include #define pb push_back #define rep(i,j,k) for(int i=(j);i<=(int)k;i++) #define per(i,j,k) for(int i=(j);i>=(int)k;i--) #define lowbit(x) ((x)&(-(x))) #define fi first #define se second #define pii pair #define VI vector #define S(x) x.size() using namespace std; typedef long long LL; typedef double db; int x[5],y[5],z[5]; inline LL dis(int a,int b){ return (x[a]-x[b])*1ll*(x[a]-x[b])+(y[a]-y[b])*1ll*(y[a]-y[b])+(z[a]-z[b])*1ll*(z[a]-z[b]); } int a[5]; int main(){ int T;scanf("%d",&T); rep(Cas,1,T){ rep(i,1,4)scanf("%d%d%d",&x[i],&y[i],&z[i]); bool fl=1; rep(i,1,4){ LL tmp[4];int m=0; rep(j,1,4)if(i^j)tmp[++m]=dis(i,j); sort(tmp+1,tmp+1+3); if(tmp[3]!=tmp[1]*2ll||tmp[3]!=tmp[2]*2ll)fl=0; } if(fl)printf("Case #%d: Yes\n",Cas); else printf("Case #%d: No\n",Cas); } return 0; }