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;
struct node {
  int a[3];
  int id;
  bool operator<(const node &x) const { return id < x.id; }
  bool operator==(const node &x) const {
    int t[3], p[3];
    for (int i = 0; i < (3); i++) t[i] = x.a[i];
    for (int i = 0; i < (3); i++) p[i] = a[i];
    sort(t, t + 3);
    sort(p, p + 3);
    for (int i = 0; i < (3); i++)
      if (t[i] != p[i]) return false;
    return true;
  }
  void print() {
    for (int i = 0; i < (3); i++) cout << a[i] << " ";
    cout << endl;
  }
  long long operator*(const node &x) const {
    long long ans = 0;
    for (int i = 0; i < (3); i++) ans += (long long)x.a[i] * a[i];
    return ans;
  }
  int len() {
    for (int i = 0; i < (3); i++)
      if (a[i] != 0) return true;
    return false;
  }
};
int P1[3], P2[3], P3[3], P4[3];
node get(node a, node b) {
  node p;
  for (int i = 0; i < (3); i++) p.a[i] = b.a[i] - a.a[i];
  return p;
}
node add(node a, node b) {
  node p;
  for (int i = 0; i < (3); i++) p.a[i] = a.a[i] + b.a[i];
  return p;
}
node cube[8];
vector<node> ans;
int main() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < (8); i++) {
    node x;
    for (int j = 0; j < (3); j++) cin >> x.a[j];
    x.id = i;
    cube[i] = x;
  }
  do {
    for (int i = 0; i < (3); i++) P1[i] = P2[i] = P3[i] = P4[i] = i;
    node O, A, B, C;
    O.id = cube[0].id;
    A.id = cube[1].id;
    B.id = cube[2].id;
    C.id = cube[3].id;
    do {
      for (int i = 0; i < (3); i++) C.a[i] = cube[3].a[P4[i]];
      do {
        for (int i = 0; i < (3); i++) B.a[i] = cube[2].a[P3[i]];
        do {
          for (int i = 0; i < (3); i++) A.a[i] = cube[1].a[P2[i]];
          do {
            for (int i = 0; i < (3); i++) O.a[i] = cube[0].a[P1[i]];
            node X = get(O, A);
            node Y = get(O, B);
            node Z = get(O, C);
            if (!X.len() || !Y.len() || !Z.len()) continue;
            if (X * Y != 0LL || Y * Z != 0LL || X * Z != 0LL) continue;
            node P = add(A, Z);
            P.id = cube[4].id;
            node Q = add(B, Z);
            Q.id = cube[5].id;
            node R = add(C, add(X, Y));
            R.id = cube[6].id;
            node S = add(O, add(X, Y));
            S.id = cube[7].id;
            if (P == cube[4] && Q == cube[5] && R == cube[6] && S == cube[7]) {
              cout << "YES" << endl;
              ans.clear();
              ans.push_back(A);
              ans.push_back(B);
              ans.push_back(C);
              ans.push_back(O);
              ans.push_back(P);
              ans.push_back(Q);
              ans.push_back(R);
              ans.push_back(S);
              sort(ans.begin(), ans.end());
              for (int i = 0; i < (ans.size()); i++)
                cout << ans[i].a[0] << " " << ans[i].a[1] << " " << ans[i].a[2]
                     << endl;
              return 0;
            }
          } while (next_permutation(P1, P1 + 3));
        } while (next_permutation(P2, P2 + 3));
      } while (next_permutation(P3, P3 + 3));
    } while (next_permutation(P4, P4 + 3));
  } while (next_permutation(cube + 1, cube + 8));
  cout << "NO" << endl;
  return 0;
}