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 Point {
  long long x, y, z;
};
bool found = 0;
Point p[8];
long long dot(Point a, Point b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
bool IsCube() {
  Point q[8];
  for (int i = 0; i < 8; ++i) {
    q[i].x = p[i].x - p[0].x;
    q[i].y = p[i].y - p[0].y;
    q[i].z = p[i].z - p[0].z;
  }
  pair<long long, int> d[8];
  for (int i = 0; i < 8; ++i) {
    d[i].first = dot(q[i], q[i]);
    d[i].second = i;
  }
  sort(d, d + 8);
  long long d1 = d[1].first;
  if (d1 == 0) return false;
  if (d[0].first == 0 && d1 == d[2].first && d1 == d[3].first &&
      2 * d1 == d[4].first && 2 * d1 == d[5].first && 2 * d1 == d[6].first &&
      3 * d1 == d[7].first) {
  } else
    return false;
  int edges[6][4] = {{0, 1, 0, 2}, {0, 1, 0, 3}, {0, 2, 0, 3},
                     {7, 6, 7, 5}, {7, 5, 7, 4}, {7, 4, 7, 6}};
  for (int i = 0; i < 6; ++i) {
    Point A = q[d[edges[i][0]].second], B = q[d[edges[i][2]].second];
    A.x -= q[d[edges[i][1]].second].x;
    A.y -= q[d[edges[i][1]].second].y;
    A.z -= q[d[edges[i][1]].second].z;
    B.x -= q[d[edges[i][3]].second].x;
    B.y -= q[d[edges[i][3]].second].y;
    B.z -= q[d[edges[i][3]].second].z;
    if (dot(A, B) != 0) return false;
    if (dot(A, A) != d1) return false;
    if (dot(B, B) != d1) return false;
  }
  for (int i = 1; i <= 3; ++i) {
    long long dd[3];
    for (int j = 4; j <= 6; ++j) {
      Point E = q[d[i].second];
      E.x -= q[d[j].second].x;
      E.y -= q[d[j].second].y;
      E.z -= q[d[j].second].z;
      dd[j - 4] = dot(E, E);
    }
    sort(dd, dd + 3);
    if (dd[0] == d1 && dd[1] == d1 && dd[2] == 3 * d1) {
    } else
      return false;
  }
  return true;
}
void Perm(int pos) {
  if (found) return;
  if (pos == 8) {
    if (IsCube()) {
      cout << "YES\n";
      for (int i = 0; i < 8; ++i) {
        cout << p[i].x << ' ' << p[i].y << ' ' << p[i].z << '\n';
      }
      found = true;
    }
    return;
  }
  long long xyz[3];
  int ind[3] = {0, 1, 2};
  xyz[0] = p[pos].x;
  xyz[1] = p[pos].y;
  xyz[2] = p[pos].z;
  do {
    p[pos].x = xyz[ind[0]];
    p[pos].y = xyz[ind[1]];
    p[pos].z = xyz[ind[2]];
    Perm(pos + 1);
  } while (next_permutation(ind, ind + 3));
  p[pos].x = xyz[0];
  p[pos].y = xyz[1];
  p[pos].z = xyz[2];
}
int main() {
  for (int i = 0; i < 8; ++i) {
    cin >> p[i].x >> p[i].y >> p[i].z;
  }
  Perm(1);
  if (!found) cout << "NO\n";
  return 0;
}