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;
long long w[8][3];
int shuff[6][3];
void push(vector<vector<long long> > &needs, long long a, long long b,
          long long c) {
  vector<long long> next;
  next.push_back(a);
  next.push_back(b);
  next.push_back(c);
  needs.push_back(next);
}
bool seek(vector<vector<long long> > &needs, long long &a, long long &b,
          long long &c) {
  for (int i = 0; i < needs.size(); i++) {
    for (int p = 0; p < 6; p++) {
      if (a == needs[i][shuff[p][0]] && b == needs[i][shuff[p][1]] &&
          c == needs[i][shuff[p][2]]) {
        a = needs[i][0];
        b = needs[i][1];
        c = needs[i][2];
        needs.erase(needs.begin() + i);
        return true;
      }
    }
  }
  return false;
}
int main() {
  shuff[0][0] = 0;
  shuff[0][1] = 1;
  shuff[0][2] = 2;
  shuff[1][0] = 0;
  shuff[1][1] = 2;
  shuff[1][2] = 1;
  shuff[2][0] = 1;
  shuff[2][1] = 0;
  shuff[2][2] = 2;
  shuff[3][0] = 1;
  shuff[3][1] = 2;
  shuff[3][2] = 0;
  shuff[4][0] = 2;
  shuff[4][1] = 0;
  shuff[4][2] = 1;
  shuff[5][0] = 2;
  shuff[5][1] = 1;
  shuff[5][2] = 0;
  for (int i = 0; i < 8; i++) {
    cin >> w[i][0] >> w[i][1] >> w[i][2];
  }
  int o[3];
  o[0] = w[0][0];
  o[1] = w[0][1];
  o[2] = w[0][2];
  for (int i = 1; i < 8; i++)
    for (int j = i + 1; j < 8; j++)
      for (int k = j + 1; k < 8; k++) {
        for (int pi = 0; pi < 6; pi++)
          for (int pj = 0; pj < 6; pj++)
            for (int pk = 0; pk < 6; pk++) {
              long long x[3], y[3], z[3];
              for (int l = 0; l < 3; l++) {
                x[l] = w[i][shuff[pi][l]] - o[l];
                y[l] = w[j][shuff[pj][l]] - o[l];
                z[l] = w[k][shuff[pk][l]] - o[l];
              }
              long long dot1, dot2, dot3;
              dot1 = dot2 = dot3 = 0;
              for (int l = 0; l < 3; l++) {
                dot1 += x[l] * x[l];
                dot2 += y[l] * y[l];
                dot3 += z[l] * z[l];
              }
              if (dot1 != dot2 || dot1 != dot3) continue;
              if (dot1 == 0) continue;
              dot1 = dot2 = dot3 = 0;
              for (int l = 0; l < 3; l++) {
                dot1 += y[l] * z[l];
                dot2 += z[l] * x[l];
                dot3 += x[l] * y[l];
              }
              if (dot1 != 0 || dot2 != 0 || dot3 != 0) continue;
              vector<vector<long long> > needs;
              push(needs, o[0] + x[0] + y[0], o[1] + x[1] + y[1],
                   o[2] + x[2] + y[2]);
              push(needs, o[0] + x[0] + z[0], o[1] + x[1] + z[1],
                   o[2] + x[2] + z[2]);
              push(needs, o[0] + z[0] + y[0], o[1] + z[1] + y[1],
                   o[2] + z[2] + y[2]);
              push(needs, o[0] + x[0] + y[0] + z[0], o[1] + x[1] + y[1] + z[1],
                   o[2] + x[2] + y[2] + z[2]);
              bool fail = false;
              for (int l = 1; l < 8 && !fail; l++) {
                if (l == i || l == j || l == k) continue;
                if (!seek(needs, w[l][0], w[l][1], w[l][2])) fail = true;
              }
              if (fail) continue;
              for (int l = 0; l < 3; l++) {
                w[i][l] = x[l] + o[l];
                w[j][l] = y[l] + o[l];
                w[k][l] = z[l] + o[l];
              }
              cout << "YES" << endl;
              for (int l = 0; l < 8; l++)
                cout << w[l][0] << " " << w[l][1] << " " << w[l][2] << endl;
              return 0;
            }
      }
  cout << "NO" << endl;
}