func_code_string: #include <bits/stdc++.h>   using namespace std;   struct point {     int x, y;   } a[5], b[5];   int ans;   int dis(int i, int j) {     int res = (a[i].x - a[j].x) * (a[i].x - a[j].x);     return res + (a[i].y - a[j].y) * (a[i].y - a[j].y);   }   int ok() {     map<int, int> mp;     for (int i = 1; i < 4; i++)       for (int j = i + 1; j <= 4; j++) mp[dis(i, j)]++;     if (mp.size() != 2) return 0;     int t;     for (auto tmp : mp) {       if (tmp.first == 0) return 0;       t = tmp.second;     }     if (t == 4 || t == 2) return 1;     return 0;   }   void Rotate(int p) {     int x = a[p].x - b[p].x, y = a[p].y - b[p].y;     a[p].x = -y + b[p].x;     a[p].y = x + b[p].y;   }   void dfs(int p, int step) {     if (p == 5) {       if (ok()) ans = min(ans, step);       return;     }     dfs(p + 1, step);     for (int i = 1; i < 4; i++) {       Rotate(p);       dfs(p + 1, step + i);     }     Rotate(p);   }   int main() {     int T;     cin >> T;     while (T--) {       ans = 100;       for (int i = 1; i <= 4; i++) cin >> a[i].x >> a[i].y >> b[i].x >> b[i].y;       dfs(1, 0);       if (ans == 100)         puts( -1 );       else         cout << ans << endl;     }   }   