Problem: You're given the centers of three equal sides of a strictly convex tetragon. Your task is to restore the initial tetragon.

Input

The first input line contains one number T — amount of tests (1 ≤ T ≤ 5·104). Each of the following T lines contains numbers x1, y1, x2, y2, x3, y3 — coordinates of different points that are the centers of three equal sides (non-negative integer numbers, not exceeding 10).

Output

For each test output two lines. If the required tetragon exists, output in the first line YES, in the second line — four pairs of numbers — coordinates of the polygon's vertices in clockwise or counter-clockwise order. Don't forget, please, that the tetragon should be strictly convex, i.e. no 3 of its points lie on one line. Output numbers with 9 characters after a decimal point.

If the required tetragon doen't exist, output NO in the first line, and leave the second line empty.

Examples

Input

3
1 1 2 2 3 3
0 1 1 0 2 2
9 3 7 9 9 8


Output

NO

YES
3.5 1.5 0.5 2.5 -0.5 -0.5 2.5 0.5
NO

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const double INF = 1 << 29;
struct point {
  double x, y;
  bool have;
  point() {
    x = 0;
    y = 0;
  }
  friend bool operator<(const point& a, const point& b) {
    return (a.x < b.x) || (fabs(a.x - b.x) < eps && a.y < b.y);
  }
  point(double x, double y) : x(x), y(y) {}
};
point a[8], b[8], c[8], d[8];
double cross(point a, point b) { return a.x * b.y - a.y * b.x; }
point operator-(const point& a, const point& b) {
  return point(a.x - b.x, a.y - b.y);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    memset(d, 0, sizeof(d));
    for (int k = 0; k < 3; k++) {
      scanf("%lf %lf", &a[k].x, &a[k].y);
      a[k].have = 1;
    }
    if (a[0].x == a[1].x && a[2].x == a[1].x) {
      printf("NO\n\n");
      continue;
    } else if (a[0].x != a[1].x && a[1].x != a[2].x) {
      double r1, r2;
      r1 = (a[0].y - a[1].y) / (a[0].x - a[1].x);
      r2 = (a[2].y - a[1].y) / (a[2].x - a[1].x);
      if (fabs(r1 - r2) < eps) {
        printf("NO\n\n");
        continue;
      }
    }
    int i;
    double x, y;
    for (i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) c[j] = a[j];
      c[3].have = 0;
      x = a[(i + 1) % 3].x - a[i].x;
      y = a[(i + 1) % 3].y - a[i].y;
      c[3].x = a[(i + 2) % 3].x + x;
      c[3].y = a[(i + 2) % 3].y + y;
      sort(c, c + 4);
      swap(c[2], c[3]);
      int p = -1;
      if (c[0].have) {
        d[++p].x = c[0].x;
        d[p].y = c[0].y;
      }
      if (c[1].have) {
        d[++p].x = 2 * c[0].x - c[1].x;
        d[p].y = 2 * c[0].y - c[1].y;
      }
      if (c[2].have) {
        d[++p].x = c[0].x + c[3].x - c[1].x;
        d[p].y = c[0].y + c[3].y - c[1].y;
      }
      if (c[3].have) {
        d[++p].x = c[3].x;
        d[p].y = c[3].y;
      }
      point t, w, g;
      double k1 = INF, k2 = INF, b1, b2, ll;
      t = point((d[0].x + d[1].x) / 2.0, (d[0].y + d[1].y) / 2.0);
      w = point((d[2].x + d[1].x) / 2.0, (d[2].y + d[1].y) / 2.0);
      if (fabs(d[0].y - d[1].y) < eps && fabs(d[2].y - d[1].y) < eps) continue;
      if (fabs(d[0].y - d[1].y) > eps) {
        k1 = -(d[0].x - d[1].x) / (d[0].y - d[1].y);
        b1 = t.y - t.x * k1;
      }
      if (fabs(d[2].y - d[1].y) > eps) {
        k2 = -(d[2].x - d[1].x) / (d[2].y - d[1].y);
        b2 = w.y - w.x * k2;
      }
      if (fabs(k1 - k2) < eps) continue;
      if (fabs(d[0].y - d[1].y) < eps) {
        g.x = t.x;
        g.y = g.x * k2 + b2;
      } else if (fabs(d[2].y - d[1].y) < eps) {
        g.x = w.x;
        g.y = g.x * k1 + b1;
      } else {
        g.x = (b2 - b1) / (k1 - k2);
        g.y = g.x * k1 + b1;
      }
      b[0].x = g.x, b[0].y = g.y;
      for (int j = 0; j < 3; j++) {
        b[j + 1].x = 2 * c[j].x - b[j].x;
        b[j + 1].y = 2 * c[j].y - b[j].y;
      }
      double aa, bb;
      aa = cross(b[0] - b[2], b[1] - b[2]);
      bb = cross(b[0] - b[2], b[3] - b[2]);
      if (fabs(aa) < eps || fabs(bb) < eps || aa * bb > 0) continue;
      aa = cross(b[1] - b[3], b[0] - b[3]);
      bb = cross(b[1] - b[3], b[2] - b[3]);
      if (fabs(aa) < eps || fabs(bb) < eps || aa * bb > 0) continue;
      printf("YES\n");
      for (int j = 0; j < 4; j++) printf("%.9lf %.9lf ", b[j].x, b[j].y);
      printf("\n");
      break;
    }
    if (i == 3) printf("NO\n\n");
  }
  return 0;
}