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;
int flag;
struct pi {
  int x;
  int y;
  int z;
} pp[9];
int yi[9][4];
int panduan(int a, int b, int c) {
  long long x1, y1, z1, x2, y2, z2;
  x1 = pp[b].x - pp[a].x;
  y1 = pp[b].y - pp[a].y;
  z1 = pp[b].z - pp[a].z;
  x2 = pp[c].x - pp[a].x;
  y2 = pp[c].y - pp[a].y;
  z2 = pp[c].z - pp[a].z;
  x1 = x1 * x2 + y1 * y2 + z1 * z2;
  if (x1 == 0) return 1;
  return 0;
}
long long dis(int a, int b) {
  long long x1, y1, z1;
  x1 = (pp[a].x - pp[b].x);
  y1 = (pp[a].y - pp[b].y);
  z1 = (pp[a].z - pp[b].z);
  long long s = x1 * x1 + y1 * y1 + z1 * z1;
  return s;
}
void get(int a, int b) {
  int i, j, n, m, c, x1, y1, z, f, x2;
  c = 0;
  for (i = 2; i <= 8; i++) {
    if (i != a && i != b && panduan(1, a, i) && panduan(1, b, i)) {
      c = i;
      break;
    }
  }
  if (!c) return;
  m = 0;
  for (i = 2; i <= 8; i++) {
    if (i != a && i != b && i != c && panduan(a, i, 1)) {
      if (m == 1)
        y1 = i;
      else if (m == 0)
        x1 = i;
      else
        x2 = i;
      m++;
    }
  }
  if (m != 3) return;
  if (panduan(a, x1, x2)) {
    y1 = x2;
  } else if (panduan(a, y1, x2))
    x1 = x2;
  if (!panduan(a, x1, y1)) return;
  if (!((panduan(x1, b, a) && panduan(y1, c, a)) ||
        (panduan(x1, c, a) && panduan(y1, b, a))))
    return;
  z = 0;
  f = 0;
  for (i = 2; i <= 8; i++) {
    if (i != a && i != b && i != c && i != x1 && i != y1) {
      if (dis(i, x1) == dis(a, y1) && panduan(i, x1, y1)) {
        z = i;
      } else if (dis(i, b) == dis(1, c) && panduan(i, b, c)) {
        f = i;
      }
    }
  }
  if (z == 0 || f == 0) return;
  if (!panduan(y1, a, z)) return;
  if (!panduan(c, f, 1)) return;
  if (!panduan(z, f, x1) || !panduan(z, f, y1) || !panduan(f, b, z) ||
      !panduan(f, c, z))
    return;
  flag = 1;
  return;
}
void cheak(void) {
  int i, j, n, m;
  long long s;
  for (i = 2; i <= 8; i++) {
    if (i == 2) {
      s = dis(i, 1);
      n = i;
    } else {
      if (s > dis(i, 1)) {
        s = dis(i, 1);
        n = i;
      }
    }
  }
  m = 0;
  int f = 0;
  for (i = 2; i <= 8; i++) {
    if (i != n && panduan(1, n, i)) {
      if (m == 0) {
        s = dis(1, i);
        f = i;
      } else {
        if (s > dis(1, i)) {
          s = dis(1, i);
          f = i;
        }
      }
      m++;
    }
  }
  if (f == 0) return;
  get(n, f);
}
void dfs(int p) {
  if (flag) return;
  if (p > 8) {
    cheak();
    return;
  }
  if (p <= 8) {
    int i;
    for (i = 1; i <= 3; i++) {
      if (flag) return;
      pp[p].x = yi[p][i];
      if (i == 3) {
        pp[p].y = yi[p][1];
        pp[p].z = yi[p][2];
        dfs(p + 1);
        if (flag) return;
        pp[p].z = yi[p][1];
        pp[p].y = yi[p][2];
        dfs(p + 1);
      } else if (i == 1) {
        pp[p].y = yi[p][2];
        pp[p].z = yi[p][3];
        dfs(p + 1);
        if (flag) return;
        pp[p].z = yi[p][2];
        pp[p].y = yi[p][3];
        dfs(p + 1);
      } else {
        pp[p].y = yi[p][3];
        pp[p].z = yi[p][1];
        dfs(p + 1);
        if (flag) return;
        pp[p].z = yi[p][3];
        pp[p].y = yi[p][1];
        dfs(p + 1);
      }
    }
    return;
  }
}
int main() {
  int i;
  flag = 0;
  for (i = 1; i <= 8; i++) cin >> yi[i][1] >> yi[i][2] >> yi[i][3];
  flag = 0;
  dfs(1);
  if (!flag)
    printf("NO\n");
  else {
    printf("YES\n");
    for (i = 1; i <= 8; i++) {
      printf("%d %d %d\n", pp[i].x, pp[i].y, pp[i].z);
    }
  }
}