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>
const int MAX = 1e3 + 11;
using namespace std;
const double eps = 0.000001;
const int N = 8;
vector<int64_t> A[N];
static inline int64_t dot(const vector<int64_t> &a, const vector<int64_t> &b) {
  int64_t res = 0;
  for (int i = 0; i < (int((a).size())); ++i) {
    res += a[i] * b[i];
  }
  return res;
}
static inline int64_t sqr(const int64_t x) { return x * x; }
static inline int64_t dis(const vector<int64_t> &a, const vector<int64_t> &b) {
  int64_t res = 0;
  for (int i = 0; i < (int((a).size())); ++i) {
    res += sqr(a[i] - b[i]);
  }
  return res;
}
static inline vector<int64_t> dif(const vector<int64_t> &a,
                                  const vector<int64_t> &b) {
  vector<int64_t> res;
  for (int i = 0; i < (int((a).size())); ++i) res.push_back(a[i] - b[i]);
  return res;
}
static int can(const vector<vector<int64_t>> &cub) {
  int64_t d = 1e17;
  for (int i = 0; i < (N); ++i) {
    for (int j = 0; j < (N); ++j) {
      if (i != j) {
        d = min(d, dis(cub[i], cub[j]));
      }
    }
  }
  if (d == 0) {
    return 0;
  }
  vector<int64_t> t[N];
  for (int i = 0; i < (N); ++i) {
    int cnt = 0;
    for (int j = 0; j < (N); ++j) {
      if (i != j) {
        if (dis(cub[i], cub[j]) == d) {
          cnt++;
          t[i].push_back(j);
        }
      }
    }
    if (cnt != 3) {
      return 0;
    }
  }
  for (int i = 0; i < (N); ++i) {
    auto x = dif(cub[i], cub[t[i][0]]);
    auto y = dif(cub[i], cub[t[i][1]]);
    auto z = dif(cub[i], cub[t[i][2]]);
    if (dot(x, y) || dot(x, z) || dot(y, z)) {
      return 0;
    }
  }
  return 1;
}
int main() {
  for (int i = 0; i < (N); ++i) {
    for (int j = 0; j < (3); ++j) {
      int(x);
      scanf("%d", &x);
      A[i].push_back(x);
    }
    sort(A[i].begin(), A[i].end());
  }
  int64_t all = pow(6, 7);
  for (int i = 0; i < (all); ++i) {
    int64_t x = i;
    vector<vector<int64_t>> res(A, A + N);
    for (int j = 0; j < (7); ++j) {
      for (int p = 0; p < (x % 6); ++p) {
        next_permutation(res[j].begin(), res[j].end());
      }
      x /= 6;
    }
    if (!can(res)) continue;
    cout << "YES\n";
    for (int x = 0; x < (int((res).size())); ++x) {
      for (int y = 0; y < (int((res[x]).size())); ++y) {
        cout << res[x][y] << " ";
      }
      cout << "\n";
    }
    return 0;
  }
  cout << "NO";
  return 0;
}