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;
const int ind[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2},
                       {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
const double EPS = 0.0001;
int a[8][3], b[8][3], zero[3];
inline double equald(double a, double b) {
  return a - b <= EPS && b - a <= EPS;
}
inline long long distsqr(int x0, int yy, int z0, int x1, int Yy, int z1) {
  long long xd = x0 - x1, yd = yy - Yy, zd = z0 - z1;
  return xd * xd + yd * yd + zd * zd;
}
void dfs(int x) {
  if (x == 8) {
    map<long long, int> cnt;
    for (int i = 1; i < 8; i++)
      cnt[distsqr(b[0][0], b[0][1], b[0][2], b[i][0], b[i][1], b[i][2])]++;
    map<long long, int>::const_iterator curr = cnt.end();
    for (map<long long, int>::const_iterator it = cnt.begin(); it != cnt.end();
         it++) {
      if (it->second == 3 && (curr == cnt.end() || it->first < curr->first))
        curr = it;
    }
    if (curr == cnt.end()) return;
    int bcnt = 0;
    long long base[3][3];
    for (int i = 1; i < 8; i++)
      if (distsqr(b[0][0], b[0][1], b[0][2], b[i][0], b[i][1], b[i][2]) ==
          curr->first) {
        base[bcnt][0] = b[i][0] - b[0][0];
        base[bcnt][1] = b[i][1] - b[0][1];
        base[bcnt][2] = b[i][2] - b[0][2];
        bcnt++;
      }
    assert(bcnt == 3);
    if (base[0][0] * base[1][0] + base[0][1] * base[1][1] +
            base[0][2] * base[1][2] !=
        0)
      return;
    long long ortho[3] = {base[0][1] * base[1][2] - base[0][2] * base[1][1],
                          base[0][2] * base[1][0] - base[0][0] * base[1][2],
                          base[0][0] * base[1][1] - base[0][1] * base[1][0]};
    int p = 0;
    while (ortho[p] == 0) p++;
    if (p > 3) return;
    double scale = base[2][p] / double(ortho[p]);
    if (!equald(base[2][0], ortho[0] * scale) ||
        !equald(base[2][1], ortho[1] * scale) ||
        !equald(base[2][2], ortho[2] * scale))
      return;
    set<pair<pair<int, int>, int> > s1, s2;
    for (int i = 0; i < 8; i++)
      s1.insert(make_pair(make_pair(b[i][0], b[i][1]), b[i][2]));
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++)
        for (int k = 0; k < 2; k++) {
          int pos[3] = {b[0][0], b[0][1], b[0][2]};
          if (i == 1)
            pos[0] += base[0][0], pos[1] += base[0][1], pos[2] += base[0][2];
          if (j == 1)
            pos[0] += base[1][0], pos[1] += base[1][1], pos[2] += base[1][2];
          if (k == 1)
            pos[0] += base[2][0], pos[1] += base[2][1], pos[2] += base[2][2];
          s2.insert(make_pair(make_pair(pos[0], pos[1]), pos[2]));
        }
    if (s1 != s2) return;
    printf("YES\n");
    for (int i = 0; i < 8; i++)
      printf("%d %d %d\n", b[i][0] + zero[0], b[i][1] + zero[1],
             b[i][2] + zero[2]);
    exit(0);
  }
  for (int i = 0; i < 6; i++) {
    b[x][0] = a[x][ind[i][0]];
    b[x][1] = a[x][ind[i][1]];
    b[x][2] = a[x][ind[i][2]];
    dfs(x + 1);
    if (x < 1) return;
  }
}
int main() {
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 3; j++) scanf("%d", a[i] + j);
  dfs(0);
  printf("NO\n");
  return 0;
}