func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long inf = 1e18;   const long long M = 1e9 + 9;   long long axm(long long a, long long x, long long m) {     a %= m;     long long r = 1;     while (x > 0) {       if (x & 1) r = r * a % m;       a = a * a % m;       x /= 2;     }     return r;   }   long long inv(long long a, long long m) { return axm(a, m - 2, m); }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   struct P {     long long x, y;   };   long long dist(P a, P b) {     return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);   }   long long test(P p1, P p2, P p3, P p4) {     long long d2 = dist(p1, p2);     long long d3 = dist(p1, p3);     long long d4 = dist(p1, p4);     if (d2 == 0 || d3 == 0 || d4 == 0) return 0;     if (d2 == d3 && 2 * d2 == d4 && 2 * dist(p2, p4) == dist(p2, p3)) {       return 1;     }     if (d3 == d4 && 2 * d3 == d2 && 2 * dist(p3, p2) == dist(p3, p4)) {       return 1;     }     if (d2 == d4 && 2 * d2 == d3 && 2 * dist(p2, p3) == dist(p2, p4)) {       return 1;     }     return 0;   }   P p[4][4];   int main(int argc, char **argv) {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     ;     long long n;     cin >> n;     for (long long tt = 0; tt < n; tt++) {       for (long long i = 0; i < 4; i++) {         long long xx, yy, aa, bb;         cin >> xx >> yy >> aa >> bb;         p[i][0].x = xx;         p[i][0].y = yy;         for (long long j = 1; j < 4; j++) {           p[i][j].x = aa - (p[i][j - 1].y - bb);           p[i][j].y = bb + (p[i][j - 1].x - aa);         }       }       long long ans = inf;       for (long long i = 0; i < 4; i++) {         for (long long j = 0; j < 4; j++) {           for (long long k = 0; k < 4; k++) {             for (long long l = 0; l < 4; l++) {               long long s = i + j + k + l;               if (s < ans && test(p[0][i], p[1][j], p[2][k], p[3][l])) {                 ans = s;               }             }           }         }       }       if (ans == inf) ans = -1;       cout << ans <<   n ;     }     return 0;   }   