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;
template <class T>
void debug(T a, T b) {
  ;
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
namespace std {
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& a) {
  out << '(' << a.first << ',' << a.second << ')';
  return out;
}
}  // namespace std
long long int readL() {
  long long int res;
  scanf("%I64d", &res);
  return res;
}
void printL(long long int res) { printf("%I64d", res); }
vector<long long int> ps[10];
vector<long long int> res[10];
vector<long long int> adj[4], other[4];
int n = 8;
vector<long long int> calc(vector<long long int> a, vector<long long int> b,
                           vector<long long int> c) {
  vector<long long int> res(3);
  for (int i = 0; i < (3); ++i) res[i] = a[i] + b[i] - c[i];
  return res;
}
bool same(vector<long long int> a, vector<long long int> b) {
  sort((a).begin(), (a).end());
  sort((b).begin(), (b).end());
  return a == b;
}
void print() {
  puts("YES");
  int used[8] = {0};
  for (int i = 0; i < (8); ++i) {
    for (int j = 0; j < (8); ++j)
      if (!used[j] && same(res[j], ps[i])) {
        printf("%d %d %d\n", (int)res[j][0], (int)res[j][1], (int)res[j][2]);
        used[j] = 1;
        break;
      }
  }
  exit(0);
}
void check() {
  vector<long long int> want[4];
  want[0] = calc(adj[1], adj[2], adj[0]);
  want[1] = calc(adj[2], adj[3], adj[0]);
  want[2] = calc(adj[1], adj[3], adj[0]);
  want[3] = calc(want[0], adj[3], adj[0]);
  int perm[4] = {0, 1, 2, 3};
  do {
    int fail = 0;
    for (int i = 0; i < (4); ++i)
      if (!same(other[perm[i]], want[i])) fail = 1;
    if (!fail) {
      for (int i = 0; i < (4); ++i) res[i] = adj[i];
      for (int i = 0; i < (4); ++i) res[i + 4] = want[i];
      print();
    }
  } while (next_permutation(perm, perm + 4));
}
vector<long long int> subt(vector<long long int> a, vector<long long int> b) {
  vector<long long int> res(3);
  for (int i = 0; i < (3); ++i) res[i] = a[i] - b[i];
  return res;
}
long long int dot(vector<long long int> a, vector<long long int> b) {
  long long int res = 0;
  for (int i = 0; i < (3); ++i) res += a[i] * b[i];
  return res;
}
long long int len(vector<long long int> a) {
  long long int res = 0;
  for (int i = 0; i < (3); ++i) res += a[i] * a[i];
  return res;
}
void dfs(int ind) {
  if (ind == 4) {
    vector<long long int> a = subt(adj[1], adj[0]), b = subt(adj[2], adj[0]),
                          c = subt(adj[3], adj[0]);
    if (dot(a, b) || dot(b, c) || dot(c, a) || len(a) != len(b) ||
        len(b) != len(c) || len(c) != len(a) || len(a) == 0)
      ;
    else
      check();
    return;
  }
  sort((adj[ind]).begin(), (adj[ind]).end());
  do {
    dfs(ind + 1);
  } while (next_permutation((adj[ind]).begin(), (adj[ind]).end()));
}
int main() {
  for (int i = 0; i < (n); ++i) {
    ps[i].resize(3);
    for (int j = 0; j < (3); ++j) cin >> ps[i][j];
  }
  int perm[7] = {0};
  for (int i = 0; i < (3); ++i) perm[6 - i] = 1;
  do {
    int cnt = 0;
    adj[cnt++] = ps[0];
    for (int i = 0; i < (7); ++i)
      if (perm[i]) adj[cnt++] = ps[i + 1];
    cnt = 0;
    for (int i = 0; i < (7); ++i)
      if (!perm[i]) other[cnt++] = ps[i + 1];
    dfs(0);
  } while (next_permutation(perm, perm + 7));
  puts("NO");
  return 0;
}