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;
  point operator+(const point &p) const {
    point tp;
    tp.x = x + p.x;
    tp.y = y + p.y;
    tp.z = z + p.z;
    return tp;
  }
  point operator-(const point &p) const {
    point tp;
    tp.x = x - p.x;
    tp.y = y - p.y;
    tp.z = z - p.z;
    return tp;
  }
};
point a[8];
point p;
int cnt, ocnt;
int inds[8], oind[8];
inline long long dis(const point &p0, const point &p1) {
  return ((p0.x - p1.x) * (p0.x - p1.x)) + ((p0.y - p1.y) * (p0.y - p1.y)) +
         ((p0.z - p1.z) * (p0.z - p1.z));
}
inline long long dot(const point &p0, const point &p1) {
  return p0.x * p1.x + p0.y * p1.y + p0.z * p1.z;
}
bool is_valid() {
  cnt = ocnt = 0;
  long long minv = -1, cl;
  for (int i = 1; i < 8; i++) {
    cl = dis(a[0], a[i]);
    if (cl == 0) return false;
    if (minv == -1 || cl < minv) {
      for (int j = 1; j <= cnt; j++) oind[++ocnt] = inds[j];
      minv = cl;
      cnt = 1;
      inds[cnt] = i;
    } else if (cl == minv) {
      inds[++cnt] = i;
    } else {
      oind[++ocnt] = i;
    }
  }
  if (cnt != 3) return false;
  if (dot(a[inds[2]], a[inds[1]]) != 0) return false;
  if (dot(a[inds[3]], a[inds[1]]) != 0) return false;
  if (dot(a[inds[3]], a[inds[2]]) != 0) return false;
  bool flag;
  for (int c = 1; c <= 4; c++) {
    if (c == 1)
      p = a[inds[2]] + a[inds[1]];
    else if (c == 2)
      p = a[inds[1]] + a[inds[3]];
    else if (c == 3)
      p = a[inds[3]] + a[inds[2]];
    else if (c == 4)
      p = a[inds[1]] + a[inds[3]] + a[inds[2]];
    flag = false;
    for (int i = 1; i <= ocnt; i++) {
      int j = oind[i];
      if (p.x == a[j].x && p.y == a[j].y && p.z == a[j].z) {
        flag = true;
        break;
      }
    }
    if (!flag) return false;
  }
  return true;
}
bool check(int cur) {
  if (cur == 8) {
    point p = a[0];
    for (int i = 0; i < 8; i++) a[i] = a[i] - p;
    bool flag = is_valid();
    for (int i = 0; i < 8; i++) a[i] = a[i] + p;
    return flag;
  }
  if (check(cur + 1)) return true;
  swap(a[cur].y, a[cur].z);
  if (check(cur + 1)) return true;
  swap(a[cur].x, a[cur].z);
  if (check(cur + 1)) return true;
  swap(a[cur].y, a[cur].z);
  if (check(cur + 1)) return true;
  swap(a[cur].x, a[cur].z);
  if (check(cur + 1)) return true;
  swap(a[cur].y, a[cur].z);
  if (check(cur + 1)) return true;
  swap(a[cur].x, a[cur].z);
  return false;
}
int main() {
  for (int i = 0; i < 8; i++)
    scanf("%I64d %I64d %I64d", &a[i].x, &a[i].y, &a[i].z);
  if (check(1)) {
    printf("YES\n");
    for (int i = 0; i < 8; i++)
      printf("%I64d %I64d %I64d\n", a[i].x, a[i].y, a[i].z);
  } else
    printf("NO\n");
}