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 dir[7][4];
int a[9];
int g[9][4];
int flag;
struct point {
  int a[4];
  bool operator<(const point k) const {
    return (a[1] < k.a[1] || (a[1] == k.a[1] && a[2] < k.a[2]) ||
            (a[1] == k.a[1] && a[2] == k.a[2] && a[3] < k.a[3]));
  }
  point operator-(const point k) const {
    point tmp;
    int i;
    for (i = 1; i <= 3; i++) tmp.a[i] = a[i] - k.a[i];
    return tmp;
  }
  long long dis() {
    long long s = 0;
    int i;
    for (i = 1; i <= 3; i++) s += ((long long)a[i]) * ((long long)a[i]);
    return s;
  }
};
point tmp, gg[9];
vector<long long> v;
int check() {
  int i, j;
  v.clear();
  for (i = 1; i <= 8; i++)
    for (j = i + 1; j <= 8; j++) {
      tmp = gg[i] - gg[j];
      v.push_back(tmp.dis());
    }
  sort(v.begin(), v.end());
  if (v[0] != v[11] || v[12] != v[23] || v[24] != v[27]) return 0;
  if (v[0] == 0) return 0;
  if (v[12] != 2 * v[0] || v[24] != 3 * v[0]) return 0;
  return 1;
}
void dfs(int d) {
  if (d > 8) {
    if (check()) {
      flag = 1;
      int i, j;
      cout << "YES" << endl;
      for (i = 1; i <= 8; i++)
        cout << gg[i].a[1] << ' ' << gg[i].a[2] << ' ' << gg[i].a[3] << endl;
    }
    return;
  }
  int i, j;
  for (i = 1; i <= 6 && flag == 0; i++) {
    a[d] = i;
    for (j = 1; j <= 3; j++) gg[d].a[j] = g[d][dir[i][j]];
    dfs(d + 1);
    if (d == 1) break;
  }
  return;
}
int main() {
  dir[1][1] = 1;
  dir[1][2] = 2;
  dir[1][3] = 3;
  dir[2][1] = 1;
  dir[2][2] = 3;
  dir[2][3] = 2;
  dir[3][1] = 2;
  dir[3][2] = 1;
  dir[3][3] = 3;
  dir[4][1] = 2;
  dir[4][2] = 3;
  dir[4][3] = 1;
  dir[5][1] = 3;
  dir[5][2] = 1;
  dir[5][3] = 2;
  dir[6][1] = 3;
  dir[6][2] = 2;
  dir[6][3] = 1;
  int i, j;
  flag = 0;
  for (i = 1; i <= 8; i++)
    for (j = 1; j <= 3; j++) cin >> g[i][j];
  dfs(1);
  if (flag == 0) cout << "NO" << endl;
  return 0;
}