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;
long long p[15][5], c[15][5], pi[15];
long long d1, d2, d3, d1c, d2c, d3c, pd;
int main() {
  p[1][1] = 1;
  p[1][2] = 2;
  p[1][3] = 3;
  p[2][1] = 1;
  p[2][2] = 3;
  p[2][3] = 2;
  p[3][1] = 2;
  p[3][2] = 1;
  p[3][3] = 3;
  p[4][1] = 2;
  p[4][2] = 3;
  p[4][3] = 1;
  p[5][1] = 3;
  p[5][2] = 1;
  p[5][3] = 2;
  p[6][1] = 3;
  p[6][2] = 2;
  p[6][3] = 1;
  for (int i = 1; i <= 8; i++)
    scanf("%I64d%I64d%I64d", &c[i][1], &c[i][2], &c[i][3]);
  for (pi[1] = 1; pi[1] <= 6; pi[1]++)
    for (pi[2] = 1; pi[2] <= 6; pi[2]++)
      for (pi[3] = 1; pi[3] <= 6; pi[3]++)
        for (pi[4] = 1; pi[4] <= 6; pi[4]++)
          for (pi[5] = 1; pi[5] <= 6; pi[5]++)
            for (pi[6] = 1; pi[6] <= 6; pi[6]++)
              for (pi[7] = 1; pi[7] <= 6; pi[7]++)
                for (pi[8] = 1; pi[8] <= 6; pi[8]++) {
                  d1 = 0;
                  d2 = 0;
                  d3 = 0;
                  d1c = 0;
                  d2c = 0;
                  d3c = 0;
                  for (int i = 1; i <= 8; i++) {
                    for (int j = i + 1; j <= 8; j++) {
                      pd = (c[i][p[pi[i]][1]] - c[j][p[pi[j]][1]]) *
                           (c[i][p[pi[i]][1]] - c[j][p[pi[j]][1]]);
                      pd += (c[i][p[pi[i]][2]] - c[j][p[pi[j]][2]]) *
                            (c[i][p[pi[i]][2]] - c[j][p[pi[j]][2]]);
                      pd += (c[i][p[pi[i]][3]] - c[j][p[pi[j]][3]]) *
                            (c[i][p[pi[i]][3]] - c[j][p[pi[j]][3]]);
                      if (!d1) {
                        d1 = pd, d1c = 1;
                      } else if (pd == d1) {
                        d1c++;
                      } else if (!d2) {
                        d2 = pd, d2c = 1;
                      } else if (pd == d2) {
                        d2c++;
                      } else if (!d3) {
                        d3 = pd, d3c = 1;
                      } else if (pd == d3) {
                        d3c++;
                      } else {
                        j = 9, i = 9;
                      }
                    }
                  }
                  if (d1 > d2 && d1 > d3) {
                    if (d1c == 4 && d2c == 12 && d3c == 12) {
                      printf("YES\n");
                      for (int k = 1; k <= 8; k++)
                        printf("%I64d %I64d %I64d\n", c[k][p[pi[k]][1]],
                               c[k][p[pi[k]][2]], c[k][p[pi[k]][3]]);
                      return 0;
                    }
                  } else if (d2 > d3) {
                    if (d1c == 12 && d2c == 4 && d3c == 12) {
                      printf("YES\n");
                      for (int k = 1; k <= 8; k++)
                        printf("%I64d %I64d %I64d\n", c[k][p[pi[k]][1]],
                               c[k][p[pi[k]][2]], c[k][p[pi[k]][3]]);
                      return 0;
                    }
                  } else {
                    if (d1c == 12 && d2c == 12 && d3c == 4) {
                      printf("YES\n");
                      for (int k = 1; k <= 8; k++)
                        printf("%I64d %I64d %I64d\n", c[k][p[pi[k]][1]],
                               c[k][p[pi[k]][2]], c[k][p[pi[k]][3]]);
                      return 0;
                    }
                  }
                }
  printf("NO\n");
}