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 vec3i {
  int x, y, z;
  vec3i operator-(const vec3i& b) { return {x - b.x, y - b.y, z - b.z}; }
  vec3i operator+(const vec3i& b) { return {x + b.x, y + b.y, z + b.z}; }
  vec3i crs(const vec3i& b) {
    return {y * b.z - z * b.y, z * b.x - x * b.z, x * b.y - y * b.x};
  }
  int64_t dot(const vec3i& b) { return x * b.x + y * b.y + z * b.z; }
  bool operator==(const vec3i& b) { return x == b.x && y == b.y && z == b.z; }
};
ostream& operator<<(ostream& out, vec3i& v) {
  return out << v.x << ' ' << v.y << ' ' << v.z;
}
int a[9][4];
vector<int> perms[6];
vec3i pts[9];
int64_t dist2(int a, int b) {
  if (a == b) return 0;
  int64_t dx = pts[a].x - pts[b].x;
  int64_t dy = pts[a].y - pts[b].y;
  int64_t dz = pts[a].z - pts[b].z;
  return dx * dx + dy * dy + dz * dz;
}
void sort_by_dist(vector<int>& v, int to) {
  sort(v.begin(), v.end(),
       [&](int a, int b) { return dist2(a, to) < dist2(b, to); });
}
bool has_point(vec3i pt) {
  for (int i = 1; i <= 8; i++) {
    if (pts[i] == pt) return true;
  }
  return false;
}
bool is_cube() {
  vector<int> v{2, 3, 4, 5, 6, 7, 8};
  sort_by_dist(v, 1);
  int a = v[0];
  int b = v[1];
  int c = v[2];
  int64_t da = dist2(1, a);
  int64_t db = dist2(1, b);
  int64_t dc = dist2(1, c);
  if (da == 0 || db == 0 || dc == 0) return false;
  if (da != db || db != dc) return false;
  vec3i va = pts[a] - pts[1];
  vec3i vb = pts[b] - pts[1];
  vec3i vc = pts[c] - pts[1];
  if (va.dot(vb) != 0 || vb.dot(vc) != 0 || va.dot(vc) != 0) return false;
  if (0) {
    if (0) printf("has BASIS\n");
    cout << va << endl;
    cout << vb << endl;
    cout << vc << endl;
    if (0) printf("end BASIS\n");
  }
  return (has_point(pts[1] + va + vb + vc) && has_point(pts[1] + va + vb) &&
          has_point(pts[1] + va + vc) && has_point(pts[1] + vb + vc));
}
int main() {
  int pow = 1;
  for (int i = 1; i <= 8; i++) {
    pow *= 6;
    cin >> a[i][1] >> a[i][2] >> a[i][3];
  }
  for (int i = 0; i < 6; i++) {
    perms[i].push_back(1);
    perms[i].push_back(2);
    perms[i].push_back(3);
    for (int j = 0; j < i; j++) {
      next_permutation(perms[i].begin(), perms[i].end());
    }
  }
  if (0) {
    for (int i = 0; i < 6; i++) {
      printf("permutation[%d] =", i);
      for (int x : perms[i]) printf(" %d", x);
      printf("\n");
    }
  }
  if (0) printf("pow = %d\n", pow);
  for (int base6 = 0; base6 < pow; base6++) {
    int at = base6;
    for (int j = 1; j <= 8; j++) {
      int index = at % 6;
      at /= 6;
      pts[j].x = a[j][perms[index][0]];
      pts[j].y = a[j][perms[index][1]];
      pts[j].z = a[j][perms[index][2]];
    }
    if (is_cube()) {
      cout << "YES" << endl;
      for (int j = 1; j <= 8; j++) {
        cout << pts[j].x << ' ' << pts[j].y << ' ' << pts[j].z << endl;
      }
      return 0;
    }
  }
  cout << "NO" << endl;
}