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 a[8][3], b[8][3], c[8][3], pos[8][3];
long long d[8];
int n;
bool cmp(int a, int b) { return d[a] < d[b]; }
long long dist(int x) {
  return 1ll * c[x][0] * c[x][0] + 1ll * c[x][1] * c[x][1] +
         1ll * c[x][2] * c[x][2];
}
long long dot_product(int x, int y) {
  return 1ll * c[x][0] * c[y][0] + 1ll * c[x][1] * c[y][1] +
         1ll * c[x][2] * c[y][2];
}
bool check() {
  memcpy(c, a, sizeof(c));
  for (int i = 1; i < 8; i++) {
    for (int j = 0; j < 3; j++) c[i][j] -= c[0][j];
    d[i] = dist(i);
  }
  int pos[8];
  for (int i = 0; i < 7; i++) pos[i] = i + 1;
  sort(pos, pos + 7, cmp);
  if (!d[pos[0]]) return false;
  if (d[pos[0]] != d[pos[1]] || d[pos[1]] != d[pos[2]]) return false;
  for (int i = 1; i < 3; i++)
    for (int j = 0; j < i; j++)
      if (dot_product(pos[i], pos[j])) return false;
  bool appear[8];
  memset(appear, 0, sizeof(appear));
  appear[0] = appear[1] = appear[2] = appear[4] = true;
  for (int i = 3; i < 7; i++) {
    int tmp = 0;
    for (int j = 0; j < 3; j++) {
      long long tmp0 = abs(dot_product(pos[i], pos[j]));
      if (tmp0 && tmp0 != d[pos[0]]) return false;
      if (tmp0) tmp |= 1 << j;
    }
    if (appear[tmp]) return false;
    appear[tmp] = true;
  }
  return true;
}
bool dfs(int depth) {
  if (depth == 8) return check();
  for (int t = 0; t < 6; t++) {
    for (int j = 0; j < 3; j++) a[depth][j] = b[depth][pos[depth][j]];
    if (dfs(depth + 1)) return true;
    next_permutation(pos[depth], pos[depth] + 3);
  }
  return false;
}
int main() {
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 3; j++) scanf("%d", &b[i][j]), pos[i][j] = j;
  memcpy(a[0], b[0], sizeof(a[0]));
  if (dfs(1)) {
    puts("YES");
    for (int i = 0; i < 8; i++) {
      for (int j = 0; j < 3; j++) printf("%d ", a[i][j]);
      printf("\n");
    }
  } else
    puts("NO");
  return 0;
}