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>
long long p[8][3];
long long op[8][3];
bool found = false;
bool cross(long long u[3], long long v[3]) {
  return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2] == 0);
}
bool notIn(long long u[3], long long p[8][3]) {
  for (int i = 0; i < 8; i++) {
    if (p[i][0] == u[0] && p[i][1] == u[1] && p[i][2] == u[2]) return false;
  }
  return true;
}
void arrange(long long line[3], int a, int b, int c) {
  long long cp[3];
  cp[0] = line[0];
  cp[1] = line[1];
  cp[2] = line[2];
  line[0] = cp[a];
  line[1] = cp[b];
  line[2] = cp[c];
}
void decode(long long q[8][3], int code[8]) {
  for (int i = 0; i < 8; i++) {
    switch (code[i]) {
      case 0: {
        arrange(q[i], 0, 1, 2);
        break;
      }
      case 1: {
        arrange(q[i], 0, 2, 1);
        break;
      }
      case 2: {
        arrange(q[i], 1, 0, 2);
        break;
      }
      case 3: {
        arrange(q[i], 1, 2, 0);
        break;
      }
      case 4: {
        arrange(q[i], 2, 0, 1);
        break;
      }
      case 5: {
        arrange(q[i], 2, 1, 0);
        break;
      }
      default:
        break;
    }
  }
}
bool test(long long p[8][3], int code[8]) {
  long long do2[8];
  for (int i = 0; i < 8; i++) {
    do2[i] = 0;
    for (int j = 0; j < 3; j++) do2[i] += p[i][j] * p[i][j];
  }
  long long mindo2 = 1e13;
  int cnt0 = 0, cnt2 = 0, cnt3 = 0;
  std::vector<int> p1(8);
  p1.clear();
  for (int i = 0; i < 8; i++)
    if (do2[i] == 0) cnt0++;
  if (cnt0 != 1) return false;
  for (int i = 0; i < 8; i++)
    if (do2[i] < mindo2 && do2[i] > 0) mindo2 = do2[i];
  for (int i = 0; i < 8; i++) {
    if (do2[i] == 0) {
      continue;
    } else if (do2[i] == mindo2) {
      p1.push_back(i);
    } else if (do2[i] == mindo2 * 2) {
      cnt2++;
    } else if (do2[i] == mindo2 * 3) {
      cnt3++;
    } else {
      return false;
    }
  }
  if (p1.size() != 3) return false;
  if (cnt2 != 3) return false;
  if (cnt3 != 1) return false;
  for (int i = 0; i < 3; i++)
    for (int j = i + 1; j < 3; j++)
      if (!cross(p[p1[i]], p[p1[j]])) {
        return false;
      }
  for (int i = 0; i < 3; i++)
    for (int j = i + 1; j < 3; j++) {
      long long v[3];
      for (int k = 0; k < 3; k++) v[k] = p[p1[i]][k] + p[p1[j]][k];
      if (notIn(v, p)) return false;
    }
  long long v[3];
  for (int k = 0; k < 3; k++) v[k] = p[p1[0]][k] + p[p1[1]][k] + p[p1[2]][k];
  if (notIn(v, p)) return false;
  found = true;
  decode(op, code);
  printf("YES\n");
  for (int i = 0; i < 8; i++)
    printf("%d %d %d\n", (int)op[i][0], (int)op[i][1], (int)op[i][2]);
  return true;
}
long long q[8][3];
void makeSomething(long long p[8][3]) {
  int code[8];
  code[0] = 0;
  for (int i = 0; i < 279936; i++) {
    int j = 1, k = i;
    while (k > 0) {
      code[j] = k % 6;
      k /= 6;
      j++;
    }
    for (int j = 0; j < 8; j++)
      for (int k = 0; k < 3; k++) q[j][k] = p[j][k];
    decode(q, code);
    for (int j = 1; j < 8; j++)
      for (int k = 0; k < 3; k++) q[j][k] = q[j][k] - q[0][k];
    for (int k = 0; k < 3; k++) q[0][k] = 0;
    if (test(q, code)) return;
  }
}
int main() {
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 3; j++) {
      std::cin >> p[i][j];
      op[i][j] = p[i][j];
    }
  makeSomething(p);
  if (!found) {
    printf("NO\n");
  }
  return 0;
}