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 double eps = 1e-8;
const double PI = acos(-1.);
const long long MOD = 1000000007;
int n, match = 0;
int matchx[8], matchy[8];
int vis[8];
int G[8][8];
bool dfs(int u) {
  int v;
  for (int j = 0; j < 8; j++)
    if (G[u][j]) {
      v = j;
      if (vis[v]) continue;
      vis[v] = true;
      if (-1 == matchy[v] || dfs(matchy[v])) {
        matchy[v] = u;
        matchx[u] = v;
        return true;
      }
    }
  return false;
}
int t[8][3];
int main() {
  int i, j, k, l, T;
  for (i = 0; i < 8; i++) cin >> t[i][0] >> t[i][1] >> t[i][2];
  for (i = 0; i < 8; i++)
    for (j = 0; j < 3; j++) t[i][j] *= 2;
  for (i = 0; i < 8; i++) sort(t[i], t[i] + 3);
  int a, b, c;
  do {
    for (a = 1; a < 8; a++)
      for (b = a + 1; b < 8; b++)
        for (c = b + 1; c < 8; c++) {
          sort(t[a], t[a] + 3);
          sort(t[b], t[b] + 3);
          sort(t[c], t[c] + 3);
          do {
            do {
              do {
                long long d[3][3];
                for (i = 0; i < 3; i++) d[0][i] = t[a][i] - t[0][i];
                for (i = 0; i < 3; i++) d[1][i] = t[b][i] - t[0][i];
                for (i = 0; i < 3; i++) d[2][i] = t[c][i] - t[0][i];
                int fail = 0;
                for (i = 0; i < 3; i++)
                  for (j = i + 1; j < 3; j++) {
                    long long tp = 0;
                    for (k = 0; k < 3; k++) tp += 1LL * d[i][k] * d[j][k];
                    if (tp) fail = 1;
                  }
                set<long long> len;
                for (i = 0; i < 3; i++) {
                  long long dis = 0;
                  for (j = 0; j < 3; j++)
                    dis += ((1LL * d[i][j]) * (1LL * d[i][j]));
                  len.insert(dis);
                }
                if (len.size() == 1 && len.count(0) == 0 && !fail) {
                  int aim[8][3];
                  for (i = 0; i < 8; i++) {
                    for (j = 0; j < 3; j++) aim[i][j] = t[0][j];
                    for (j = 0; j < 3; j++)
                      if (i >> j & 1)
                        for (k = 0; k < 3; k++) aim[i][k] += d[j][k];
                  }
                  memset(G, 0, sizeof G);
                  for (k = 0; k < 8; k++) {
                    int q[3];
                    for (l = 0; l < 3; l++) q[l] = t[k][l];
                    sort(q, q + 3);
                    do {
                      for (l = 0; l < 8; l++)
                        if (make_pair(make_pair(q[0], q[1]), q[2]) ==
                            make_pair(make_pair(aim[l][0], aim[l][1]),
                                      aim[l][2]))
                          G[k][l] = 1;
                    } while (next_permutation(q, q + 3));
                  }
                  memset(matchx, -1, sizeof matchx);
                  memset(matchy, -1, sizeof matchy);
                  int tt = 0;
                  for (k = 0; k < 8; k++)
                    if (matchx[k] == -1) {
                      memset(vis, 0, sizeof vis);
                      if (dfs(k)) tt++;
                    }
                  if (tt == 8) {
                    puts("YES");
                    for (k = 0; k < 8; k++, cout << endl)
                      for (l = 0; l < 3; l++)
                        cout << aim[matchx[k]][l] / 2 << " ";
                    cout << endl;
                    return 0;
                  }
                }
              } while (next_permutation(t[c], t[c] + 3));
            } while (next_permutation(t[b], t[b] + 3));
          } while (next_permutation(t[a], t[a] + 3));
        }
  } while (next_permutation(t[0], t[0] + 3));
  puts("NO");
  return 0;
}