func_code_string: #include <bits/stdc++.h>   using namespace std;   inline void smin(int &a, const int &b) {     if (b < a) a = b;   }   inline void smax(int &a, const int &b) {     if (b > a) a = b;   }   int first[4], second[4], f[4], ans;   vector<int> dst, vx, vy;   pair<int, int> p[4], mp[4];   inline void solve(int X, int Y, int d) {     p[0] = pair<int, int>(X, Y), p[1] = pair<int, int>(X, Y + d), X += d;     p[2] = pair<int, int>(X, Y), p[3] = pair<int, int>(X, Y + d);     for (int i = 4; i--;) f[i] = i;     do {       int mx = 0;       for (int i = 4; i--;) {         if (first[i] == p[f[i]].first)           smax(mx, abs(second[i] - p[f[i]].second));         else if (second[i] == p[f[i]].second)           smax(mx, abs(first[i] - p[f[i]].first));         else           mx = 0x3f3f3f3f;       }       if (mx < ans) {         ans = mx;         for (int i = 4; i--;) mp[i] = p[f[i]];       }     } while (next_permutation(f, f + 4));   }   inline void solve(int d) {     vx.clear(), vy.clear();     for (int i = 4; i--;) {       vx.push_back(first[i] - d), vx.push_back(first[i]),           vx.push_back(first[i] + d);       vy.push_back(second[i] - d), vy.push_back(second[i]),           vy.push_back(second[i] + d);       for (int j = i; j--;) {         int xmn = min(first[i], first[j]), xmx = max(first[i], first[j]);         int ymn = min(second[i], second[j]), ymx = max(second[i], second[j]);         for (int k = 4; k--;)           if (k != i && k != j) {             smin(xmn, first[k] - d), smax(xmx, first[k] - d);             smin(ymn, second[k] - d), smax(ymx, second[k] - d);           }         vx.push_back(xmn + xmx >> 1), vy.push_back(ymn + ymx >> 1);       }     }     for (int first : vx)       for (int second : vy) solve(first, second, d);   }   int main() {     int t;     scanf( %d , &t);     while (t--) {       dst.clear();       for (int i = 0; i < 4; i++) {         scanf( %d %d , first + i, second + i);         for (int j = 0; j < i; j++) {           dst.push_back(abs(first[i] - first[j]));           dst.push_back(abs(second[i] - second[j]));         }       }       sort(dst.begin(), dst.end());       dst.resize(unique(dst.begin(), dst.end()) - dst.begin());       ans = 0x3f3f3f3f;       for (int first : dst) solve(first);       if (ans < 0x3f3f3f3f) {         printf( %d n , ans);         for (int i = 0; i < 4; i++) printf( %d %d n , mp[i].first, mp[i].second);       } else         puts( -1 );     }   }   