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;
const long long size = 100007;
const long long modulo = 1000000007;
const int oo = 1e9;
const double EPS = 1e-12;
const double PI = 3.14159;
struct Point {
  long long x, y, z;
  Point(long long x = 0, long long y = 0, long long z = 0) : x(x), y(y), z(z) {}
  bool operator==(const Point& other) const {
    return x == other.x && y == other.y && z == other.z;
  }
};
long long dist(Point& a, Point& b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) +
         (a.z - b.z) * (a.z - b.z);
}
vector<Point> pts;
vector<vector<long long> > a(8);
bool found = false;
long long u[8][8];
bool prel() {
  bool res = true;
  set<long long> d;
  for (int i = 0; i < pts.size(); i++)
    for (int j = i + 1; j < pts.size(); j++) {
      if (pts[i] == pts[j]) return false;
      d.insert(dist(pts[i], pts[j]));
    }
  return (d.size() <= 3);
}
bool ok() {
  map<long long, int> d;
  for (int i = 0; i < pts.size(); i++)
    for (int j = i + 1; j < pts.size(); j++) {
      u[i][j] = u[j][i] = dist(pts[i], pts[j]);
      d[u[i][j]]++;
    }
  vector<long long> keys;
  for (auto it = d.begin(); it != d.end(); it++) keys.push_back(it->first);
  if (keys.size() != 3 || 2 * keys[0] != keys[1] || 3 * keys[0] != keys[2] ||
      d[keys[0]] != 12 || d[keys[1]] != 12 || d[keys[2]] != 4)
    return false;
  int takenCount = 0;
  vector<bool> taken(8, false);
  for (int i = 0; i < 8; i++) {
    if (taken[i]) continue;
    vector<int> adj, dia, opp;
    for (int j = 0; j < 8; j++) {
      if (i == j) continue;
      if (u[i][j] == keys[0]) adj.push_back(j);
      if (u[i][j] == keys[1]) dia.push_back(j);
      if (u[i][j] == keys[2]) opp.push_back(j);
    }
    if (adj.size() != 3 || dia.size() != 3 || opp.size() != 1) return false;
    int l = opp[0];
    vector<int> adj2, dia2, opp2;
    for (int j = 0; j < 8; j++) {
      if (l == j) continue;
      if (u[l][j] == keys[0]) adj2.push_back(j);
      if (u[l][j] == keys[1]) dia2.push_back(j);
      if (u[l][j] == keys[2]) opp2.push_back(j);
    }
    if (adj2.size() != 3 || dia2.size() != 3 || opp2.size() != 1) return false;
    sort(adj.begin(), adj.end());
    sort(adj2.begin(), adj2.end());
    sort(dia.begin(), dia.end());
    sort(dia2.begin(), dia2.end());
    if (adj != dia2 || adj2 != dia) return false;
    taken[i] = taken[l] = true;
    takenCount += 2;
  }
  return takenCount == 8;
}
void go(int n) {
  if (found) return;
  if (n == 8) {
    if (!ok()) return;
    found = true;
    cout << "YES\n";
    for (int i = 0; i < 8; i++)
      cout << a[i][0] << ' ' << a[i][1] << ' ' << a[i][2] << endl;
    return;
  }
  do {
    pts.push_back(Point(a[n][0], a[n][1], a[n][2]));
    if (prel()) go(n + 1);
    pts.pop_back();
  } while (next_permutation(a[n].begin(), a[n].end()));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < 8; i++) {
    a[i].resize(3);
    cin >> a[i][0] >> a[i][1] >> a[i][2];
    sort(a[i].begin(), a[i].end());
  }
  go(0);
  if (!found) cout << "NO\n";
  return 0;
}