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;
struct Point {
  long long x, y, z;
  Point(long long x = 0, long long y = 0, long long z = 0) : x(x), y(y), z(z) {}
  Point operator+(Point p) { return Point(x + p.x, y + p.y, z + p.z); }
  Point operator-(Point p) { return Point(x - p.x, y - p.y, z - p.z); }
  bool operator==(Point p) { return x == p.x && y == p.y && z == p.z; }
};
long long dot(Point p1, Point p2) {
  return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z;
}
long long len(Point p) { return p.x * p.x + p.y * p.y + p.z * p.z; }
Point P[10], origin[10];
vector<Point> cube[10];
bool ok = false;
void test() {
  int i;
  cout << endl;
  for (i = 1; i <= 8; i++)
    printf("%I64d %I64d %I64d\n", origin[i].x, origin[i].y, origin[i].z);
  cout << endl;
  for (i = 1; i <= 8; i++)
    printf("%I64d %I64d %I64d\n", P[i].x, P[i].y, P[i].z);
  return;
}
bool check() {
  long long lenth[10], tmp;
  int smallnum = 0, midnum = 0, bignum = 0, gg[4], i, j;
  Point tt;
  memset(lenth, 0, sizeof(lenth));
  memset(gg, 0, sizeof(gg));
  for (i = 0; i < 9; i++) cube[i].clear();
  for (i = 2; i <= 8; i++)
    for (j = 1; j < i; j++)
      if (P[i] == P[j]) return false;
  for (i = 2; i <= 8; i++) origin[i] = P[i] - P[1];
  for (i = 2; i <= 8; i++) {
    tmp = len(origin[i]);
    for (j = 1; j <= lenth[0]; j++)
      if (tmp == lenth[j]) {
        cube[j].push_back(origin[i]);
        break;
      }
    if (j > lenth[0]) {
      lenth[++lenth[0]] = tmp;
      cube[j].push_back(origin[i]);
    }
  }
  if (lenth[0] != 3) return false;
  if (lenth[1] < lenth[2] && lenth[1] < lenth[3])
    smallnum = 1;
  else if (lenth[2] < lenth[1] && lenth[2] < lenth[3])
    smallnum = 2;
  else if (lenth[3] < lenth[1] && lenth[3] < lenth[2])
    smallnum = 3;
  if (smallnum == 0 || cube[smallnum].size() != 3) return false;
  if (lenth[1] > lenth[2] && lenth[1] > lenth[3])
    bignum = 1;
  else if (lenth[2] > lenth[1] && lenth[2] > lenth[3])
    bignum = 2;
  else if (lenth[3] > lenth[1] && lenth[3] > lenth[2])
    bignum = 3;
  if (bignum == 0 || cube[bignum].size() != 1) return false;
  gg[smallnum] = gg[bignum] = 1;
  if (gg[1] == 0)
    midnum = 1;
  else if (gg[2] == 0)
    midnum = 2;
  else
    midnum = 3;
  if (cube[midnum].size() != 3) return false;
  if (dot(cube[smallnum][0], cube[smallnum][1]) != 0) return false;
  if (dot(cube[smallnum][0], cube[smallnum][2]) != 0) return false;
  if (dot(cube[smallnum][1], cube[smallnum][2]) != 0) return false;
  memset(gg, 0, sizeof(gg));
  tt = cube[smallnum][0] + cube[smallnum][1];
  for (i = 0; i < 3; i++)
    if (tt == cube[midnum][i]) gg[i]++;
  tt = cube[smallnum][0] + cube[smallnum][2];
  for (i = 0; i < 3; i++)
    if (tt == cube[midnum][i]) gg[i]++;
  tt = cube[smallnum][1] + cube[smallnum][2];
  for (i = 0; i < 3; i++)
    if (tt == cube[midnum][i]) gg[i]++;
  for (i = 0; i < 3; i++)
    if (gg[i] != 1) return false;
  if (cube[smallnum][0] + cube[smallnum][1] + cube[smallnum][2] ==
      cube[bignum][0]) {
    printf("YES\n");
    for (i = 1; i <= 8; i++)
      printf("%I64d %I64d %I64d\n", P[i].x, P[i].y, P[i].z);
    ok = true;
    return true;
  }
  return false;
}
void dfs(int num) {
  if (ok) return;
  if (num == 9) {
    check();
    return;
  }
  dfs(num + 1);
  long long xx = P[num].x, yy = P[num].y, zz = P[num].z;
  P[num] = Point(xx, zz, yy);
  dfs(num + 1);
  P[num] = Point(yy, xx, zz);
  dfs(num + 1);
  P[num] = Point(yy, zz, xx);
  dfs(num + 1);
  P[num] = Point(zz, xx, yy);
  dfs(num + 1);
  P[num] = Point(zz, yy, xx);
  dfs(num + 1);
  P[num] = Point(xx, yy, zz);
}
int main() {
  int i;
  for (i = 1; i <= 8; i++) scanf("%I64d%I64d%I64d", &P[i].x, &P[i].y, &P[i].z);
  dfs(1);
  if (!ok) printf("NO");
  return 0;
}