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>
int FASTBUFFER;
using namespace std;
int a[9][4];
int dot(const int &x1, const int &y1, const int &z1, const int &x2,
        const int &y2, const int &z2) {
  return ((long long)x1 * x2 + (long long)y1 * y2 + (long long)z1 * z2) > 0LL;
}
int ok() {
  for (int i = 2; i <= 8; i++) {
    int dx1 = a[i][1] - a[1][1], dx2 = a[i][2] - a[1][2],
        dx3 = a[i][3] - a[1][3];
    if (!dx1 && !dx2 && !dx3) {
      continue;
    }
    long long dd =
        (long long)dx1 * dx1 + (long long)dx2 * dx2 + (long long)dx3 * dx3;
    for (int j = i + 1; j <= 8; j++) {
      int dy1 = a[j][1] - a[1][1], dy2 = a[j][2] - a[1][2],
          dy3 = a[j][3] - a[1][3];
      if ((long long)dy1 * dy1 + (long long)dy2 * dy2 + (long long)dy3 * dy3 !=
          dd) {
        continue;
      }
      if (dot(dx1, dx2, dx3, dy1, dy2, dy3)) {
        continue;
      }
      for (int k = i + 1; k <= 8; k++) {
        int dz1 = a[k][1] - a[1][1], dz2 = a[k][2] - a[1][2],
            dz3 = a[k][3] - a[1][3];
        if ((long long)dz1 * dz1 + (long long)dz2 * dz2 +
                (long long)dz3 * dz3 !=
            dd) {
          continue;
        }
        if (dot(dx1, dx2, dx3, dz1, dz2, dz3) ||
            dot(dy1, dy2, dy3, dz1, dz2, dz3)) {
          continue;
        }
        int now = 0;
        for (int l = 2; l <= 8; l++) {
          int dn1 = a[l][1] - a[1][1], dn2 = a[l][2] - a[1][2],
              dn3 = a[l][3] - a[1][3];
          int x = 0;
          if (dn1 == dx1 + dy1 && dn2 == dx2 + dy2 && dn3 == dx3 + dy3) {
            x = 1;
          }
          if (dn1 == dx1 + dz1 && dn2 == dx2 + dz2 && dn3 == dx3 + dz3) {
            x = 2;
          }
          if (dn1 == dy1 + dz1 && dn2 == dy2 + dz2 && dn3 == dy3 + dz3) {
            x = 4;
          }
          if (dn1 == dx1 + dy1 + dz1 && dn2 == dx2 + dy2 + dz2 &&
              dn3 == dx3 + dy3 + dz3) {
            x = 8;
          }
          now += x;
        }
        if (now == 15) {
          return 1;
        }
      }
    }
  }
  return 0;
}
void dfs(int i) {
  if (i > 8) {
    if (ok()) {
      printf("YES\n");
      for (int i = 1; i <= 8; i++) {
        printf("%d %d %d\n", a[i][1], a[i][2], a[i][3]);
      }
      exit(0);
    }
    return;
  }
  dfs(i + 1);
  swap(a[i][2], a[i][3]);
  dfs(i + 1);
  swap(a[i][1], a[i][3]);
  dfs(i + 1);
  swap(a[i][3], a[i][2]);
  dfs(i + 1);
  swap(a[i][1], a[i][3]);
  dfs(i + 1);
  swap(a[i][2], a[i][3]);
  dfs(i + 1);
}
int main() {
  for (int i = 1; i <= 8; i++) {
    scanf("%d %d %d", &a[i][1], &a[i][2], &a[i][3]);
  }
  dfs(2);
  printf("NO\n");
  return 0;
}