func_code_string: #include <bits/stdc++.h>   using namespace std;   int x[4];   int y[4];   int newx[4];   int newy[4];   int T;   int get() {     int answ = INT_MAX;     for (auto y1 : y)       for (auto y2 : y) {         int delta = abs(y1 - y2);         if (delta == 0) continue;         set<int> s;         for (auto x1 : x)           for (auto x2 : x)             for (auto d : {0, -delta, -2 * delta, 1, -delta + 1, -2 * delta + 1})               s.insert((x1 + x2 + d) / 2);         for (auto x1 : s) {           int p[4] = {3, 2, 1, 0};           for (int ori = 0; ori < 24; ori++) {             next_permutation(p, p + 4);             int xs[4] = {x1, x1, x1 + delta, x1 + delta};             int ys[4] = {y1, y2, y1, y2};             bool flag = false;             for (int i = 0; i < 4; i++)               if (xs[i] != x[p[i]] && ys[i] != y[p[i]]) {                 flag = true;               }             if (flag) continue;             int t = 0;             for (int i = 0; i < 4; i++)               t = max(t, abs(xs[i] - x[p[i]]) + abs(ys[i] - y[p[i]]));             if (answ > t) {               answ = t;               for (int i = 0; i < 4; i++) {                 newx[p[i]] = xs[i];                 newy[p[i]] = ys[i];               }             }           }         }       }     return answ;   }   int boom = 1e9;   int main() {     scanf( %d , &T);     while (T--) {       for (int i = 0; i < 4; i++) {         scanf( %d%d , &x[i], &y[i]);         x[i] = x[i] + boom;         y[i] = y[i] + boom;       }       int t1 = get();       swap(x, y);       swap(newx, newy);       int t2 = get();       swap(x, y);       swap(newx, newy);       if (t1 < t2) get();       if (min(t1, t2) == INT_MAX) {         puts( -1 );       } else {         printf( %d n , min(t1, t2));         for (int i = 0; i < 4; i++)           printf( %d %d n , newx[i] - boom, newy[i] - boom);       }     }     return 0;   }   