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;
vector<pair<vector<long long>, int> > v;
vector<vector<long long> > pt;
vector<vector<int> > auxi;
bool flag;
bool cmp(const pair<vector<long long>, int> &x,
         const pair<vector<long long>, int> &y) {
  return x.second < y.second;
}
long long dotp(vector<long long> &x, vector<long long> &y) {
  long long r = 0;
  for (int i = 0; i < 3; i++) r = r + x[i] * y[i];
  return r;
}
long long dist(vector<long long> &x) { return dotp(x, x); }
void backtrack(vector<int> &x, int ind) {
  if (ind == 4) {
    flag = 1;
    return;
  }
  for (int i = 0; i < auxi[ind].size(); i++) {
    bool xx = 0;
    for (int j = 0; j < x.size(); j++)
      if (x[j] == auxi[ind][i]) xx = 1;
    if (!xx) {
      x.push_back(auxi[ind][i]);
      backtrack(x, ind + 1);
      if (flag) return;
      x.pop_back();
    }
  }
}
void evaluate(vector<pair<vector<long long>, int> > &x) {
  vector<long long> y(3, 0);
  auxi.assign(4, vector<int>(0));
  for (int i = 0; i < 3; i++) y[i] = x[0].first[i] + x[1].first[i];
  for (int i = 0; i < v.size(); i++)
    if (v[i].second != x[0].second && v[i].second != x[1].second &&
        v[i].second != x[2].second && v[i].first == y)
      auxi[0].push_back(v[i].second);
  for (int i = 0; i < 3; i++) y[i] = x[2].first[i] + x[1].first[i];
  for (int i = 0; i < v.size(); i++)
    if (v[i].second != x[0].second && v[i].second != x[1].second &&
        v[i].second != x[2].second && v[i].first == y)
      auxi[1].push_back(v[i].second);
  for (int i = 0; i < 3; i++) y[i] = x[2].first[i] + x[0].first[i];
  for (int i = 0; i < v.size(); i++)
    if (v[i].second != x[0].second && v[i].second != x[1].second &&
        v[i].second != x[2].second && v[i].first == y)
      auxi[2].push_back(v[i].second);
  for (int i = 0; i < 3; i++)
    y[i] = x[2].first[i] + x[1].first[i] + x[0].first[i];
  for (int i = 0; i < v.size(); i++)
    if (v[i].second != x[0].second && v[i].second != x[1].second &&
        v[i].second != x[2].second && v[i].first == y)
      auxi[3].push_back(v[i].second);
  vector<int> res;
  backtrack(res, 0);
  if (flag) {
    printf("YES\n");
    printf("%lld %lld %lld\n", pt[0][0], pt[0][1], pt[0][2]);
    for (int i = 1; i < 8; i++) {
      for (int j = 0; j < 3; j++)
        if (x[j].second == i) {
          for (int k = 0; k < 3; k++) printf("%lld ", pt[0][k] + x[j].first[k]);
          printf("\n");
        }
      if (res[0] == i) {
        for (int j = 0; j < 3; j++)
          printf("%lld ", pt[0][j] + x[0].first[j] + x[1].first[j]);
        printf("\n");
      }
      if (res[1] == i) {
        for (int j = 0; j < 3; j++)
          printf("%lld ", pt[0][j] + x[2].first[j] + x[1].first[j]);
        printf("\n");
      }
      if (res[2] == i) {
        for (int j = 0; j < 3; j++)
          printf("%lld ", pt[0][j] + x[0].first[j] + x[2].first[j]);
        printf("\n");
      }
      if (res[3] == i) {
        for (int j = 0; j < 3; j++)
          printf("%lld ",
                 pt[0][j] + x[0].first[j] + x[1].first[j] + x[2].first[j]);
        printf("\n");
      }
    }
  }
}
int main() {
  pt.assign(8, vector<long long>(3, 0));
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 3; j++) scanf("%lld ", &pt[i][j]);
  for (int i = 0; i < 8; i++) sort(pt[i].begin(), pt[i].end());
  for (int i = 1; i < 8; i++) do {
      v.push_back(make_pair(pt[i], i));
    } while (next_permutation(pt[i].begin(), pt[i].end()));
  for (int i = 0; i < v.size(); i++)
    for (int j = 0; j < 3; j++) v[i].first[j] -= pt[0][j];
  sort(v.begin(), v.end());
  for (int ii = 0; ii < v.size(); ii++)
    for (int jj = ii + 1; jj < v.size(); jj++)
      if (v[ii].second != v[jj].second && !dotp(v[ii].first, v[jj].first))
        if (dist(v[ii].first) == dist(v[jj].first) && dist(v[ii].first) > 0)
          for (int kk = jj + 1; kk < v.size(); kk++)
            if (v[jj].second != v[kk].second && v[ii].second != v[kk].second)
              if (!dotp(v[ii].first, v[kk].first) &&
                  !dotp(v[jj].first, v[kk].first))
                if (dist(v[ii].first) == dist(v[kk].first)) {
                  vector<pair<vector<long long>, int> > aux;
                  aux.push_back(v[ii]);
                  aux.push_back(v[jj]);
                  aux.push_back(v[kk]);
                  evaluate(aux);
                  if (flag) return 0;
                }
  printf("NO");
  return 0;
}