Problem: Peter had a cube with non-zero length of a side. He put the cube into three-dimensional space in such a way that its vertices lay at integer points (it is possible that the cube's sides are not parallel to the coordinate axes). Then he took a piece of paper and wrote down eight lines, each containing three integers — coordinates of cube's vertex (a single line contains coordinates of a single vertex, each vertex is written exactly once), put the paper on the table and left. While Peter was away, his little brother Nick decided to play with the numbers on the paper. In one operation Nick could swap some numbers inside a single line (Nick didn't swap numbers from distinct lines). Nick could have performed any number of such operations.

When Peter returned and found out about Nick's mischief, he started recollecting the original coordinates. Help Peter restore the original position of the points or else state that this is impossible and the numbers were initially recorded incorrectly.

Input

Each of the eight lines contains three space-separated integers — the numbers written on the piece of paper after Nick's mischief. All numbers do not exceed 106 in their absolute value.

Output

If there is a way to restore the cube, then print in the first line "YES". In each of the next eight lines print three integers — the restored coordinates of the points. The numbers in the i-th output line must be a permutation of the numbers in i-th input line. The numbers should represent the vertices of a cube with non-zero length of a side. If there are multiple possible ways, print any of them.

If there is no valid way, print "NO" (without the quotes) in the first line. Do not print anything else.

Examples

Input

0 0 0
0 0 1
0 0 1
0 0 1
0 1 1
0 1 1
0 1 1
1 1 1


Output

YES
0 0 0
0 0 1
0 1 0
1 0 0
0 1 1
1 0 1
1 1 0
1 1 1


Input

0 0 0
0 0 0
0 0 0
0 0 0
1 1 1
1 1 1
1 1 1
1 1 1


Output

NO

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
static const int c[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2},
                            {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
static inline long long sqr(long long x) { return x * x; }
static inline long long dist(int x[3], int y[3]) {
  return sqr(x[0] - y[0]) + sqr(x[1] - y[1]) + sqr(x[2] - y[2]);
}
struct Point {
  long long dist;
  int i;
  Point() {}
  Point(int i, long long dist) : i(i), dist(dist) {}
};
struct Vec {
  int x, y, z;
  Vec() {}
  Vec(int x, int y, int z) : x(x), y(y), z(z) {}
};
Vec operator+(const Vec& l, const Vec& r) {
  return Vec(l.x + r.x, l.y + r.y, l.z + r.z);
}
Vec operator+(const Vec& l, const int x[3]) {
  return Vec(l.x + x[0], l.y + x[1], l.z + x[2]);
}
bool operator<(const Point& left, const Point& right) {
  return left.dist < right.dist;
}
static bool is_cube(int a[8][3]) {
  Point d[7];
  for (int i = 1; i < 8; i++) d[i - 1] = Point(i, dist(a[0], a[i]));
  sort(&d[0], &d[7]);
  if (d[0].dist == 0) return false;
  if (d[0].dist != d[2].dist || d[0].dist == d[3].dist) return false;
  if (d[3].dist != d[5].dist || d[3].dist == d[6].dist) return false;
  if (dist(a[d[0].i], a[d[1].i]) != 2 * d[0].dist) return false;
  if (dist(a[d[0].i], a[d[2].i]) != 2 * d[0].dist) return false;
  if (dist(a[d[1].i], a[d[2].i]) != 2 * d[0].dist) return false;
  int v[3][3];
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) v[i][j] = a[d[i].i][j] - a[0][j];
  Vec base(a[0][0], a[0][1], a[0][2]);
  Vec pts[4] = {base + v[0] + v[1], base + v[0] + v[2], base + v[1] + v[2],
                base + v[0] + v[1] + v[2]};
  for (int i = 0; i < 4; i++) {
    bool found = false;
    for (int j = 3; j < 7; j++) {
      if (pts[i].x == a[d[j].i][0] && pts[i].y == a[d[j].i][1] &&
          pts[i].z == a[d[j].i][2]) {
        found = true;
        break;
      }
    }
    if (!found) return false;
  }
  return true;
}
int main(int argc, const char* argv[]) {
  int a[8][3];
  int b[8][3];
  for (int i = 0; i < 8; i++) scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]);
  for (int j0 = 0; j0 < 6; j0++) {
    do {
      b[0][0] = a[0][c[j0][0]];
      b[0][1] = a[0][c[j0][1]];
      b[0][2] = a[0][c[j0][2]];
    } while (0);
    for (int j1 = 0; j1 < 6; j1++) {
      do {
        b[1][0] = a[1][c[j1][0]];
        b[1][1] = a[1][c[j1][1]];
        b[1][2] = a[1][c[j1][2]];
      } while (0);
      for (int j2 = 0; j2 < 6; j2++) {
        do {
          b[2][0] = a[2][c[j2][0]];
          b[2][1] = a[2][c[j2][1]];
          b[2][2] = a[2][c[j2][2]];
        } while (0);
        for (int j3 = 0; j3 < 6; j3++) {
          do {
            b[3][0] = a[3][c[j3][0]];
            b[3][1] = a[3][c[j3][1]];
            b[3][2] = a[3][c[j3][2]];
          } while (0);
          for (int j4 = 0; j4 < 6; j4++) {
            do {
              b[4][0] = a[4][c[j4][0]];
              b[4][1] = a[4][c[j4][1]];
              b[4][2] = a[4][c[j4][2]];
            } while (0);
            for (int j5 = 0; j5 < 6; j5++) {
              do {
                b[5][0] = a[5][c[j5][0]];
                b[5][1] = a[5][c[j5][1]];
                b[5][2] = a[5][c[j5][2]];
              } while (0);
              for (int j6 = 0; j6 < 6; j6++) {
                do {
                  b[6][0] = a[6][c[j6][0]];
                  b[6][1] = a[6][c[j6][1]];
                  b[6][2] = a[6][c[j6][2]];
                } while (0);
                for (int j7 = 0; j7 < 6; j7++) {
                  do {
                    b[7][0] = a[7][c[j7][0]];
                    b[7][1] = a[7][c[j7][1]];
                    b[7][2] = a[7][c[j7][2]];
                  } while (0);
                  if (is_cube(b)) {
                    printf("YES\n");
                    for (int i = 0; i < 8; i++)
                      printf("%d %d %d\n", b[i][0], b[i][1], b[i][2]);
                    return 0;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  printf("NO\n");
  return 0;
}