#include using namespace std; double x[4]; double y[4]; double z[4]; int main() { int T; cin >> T; int cases = 1; while(T--) { for(int i = 0 ; i < 4 ; i++) cin >> x[i] >> y[i] >> z[i]; int sign = 0; if((x[0] + x[1])/2 == (x[2] + x[3])/2 && (y[0] + y[1])/2 == (y[2] + y[3])/2 && (z[0] + z[1])/2 == (z[2] + z[3])/2) { if((x[0] - x[1]) * (x[2] - x[3]) + (y[0] - y[1]) * (y[2] - y[3]) + (z[0] - z[1]) * (z[2] - z[3]) == 0) if((x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]) + (z[0] - z[1]) * (z[0] - z[1]) == (x[2] - x[3]) * (x[2] - x[3]) + (y[2] - y[3]) * (y[2] - y[3]) + (z[2] - z[3]) * (z[2] - z[3])) sign = 1; } if((x[0] + x[2])/2 == (x[1] + x[3])/2 && (y[0] + y[2])/2 == (y[1] + y[3])/2 && (z[0] + z[2])/2 == (z[1] + z[3])/2) { if((x[0] - x[2]) * (x[1] - x[3]) + (y[0] - y[2]) * (y[1] - y[3]) + (z[0] - z[2]) * (z[1] - z[3]) == 0) if((x[0] - x[2]) * (x[0] - x[2]) + (y[0] - y[2]) * (y[0] - y[2]) + (z[0] - z[2]) * (z[0] - z[2]) == (x[1] - x[3]) * (x[1] - x[3]) + (y[1] - y[3]) * (y[1] - y[3]) + (z[1] - z[3]) * (z[1] - z[3])) sign = 1; } if((x[0] + x[3])/2 == (x[1] + x[2])/2 && (y[0] + y[3])/2 == (y[1] + y[2])/2 && (z[0] + z[3])/2 == (z[1] + z[2])/2) { if((x[0] - x[3]) * (x[1] - x[2]) + (y[0] - y[3]) * (y[1] - y[2]) + (z[0] - z[3]) * (z[1] - z[2]) == 0) if((x[0] - x[3]) * (x[0] - x[3]) + (y[0] - y[3]) * (y[0] - y[3]) + (z[0] - z[3]) * (z[0] - z[3]) == (x[2] - x[1]) * (x[2] - x[1]) + (y[2] - y[1]) * (y[2] - y[1]) + (z[2] - z[1]) * (z[2] - z[1])) sign = 1; } if(sign) cout << "Case #" << cases++ << ": Yes" << endl; else cout << "Case #" << cases++ << ": No" <