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;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
int xyz[8][3], xyz1[8][3], xyz_cur[8][3];
int p[6][3], c[35][3];
int vxyz[3][3], vxyz_all[8][3];
long long smult_all[8][8];
long long smult(int a[3], int b[3]) {
  long long ans = 0;
  for (int i = 0; i < 3; ++i) {
    ans += ((long long)a[i]) * b[i];
  }
  return ans;
}
int main() {
  p[0][0] = 0;
  p[0][1] = 1;
  p[0][2] = 2;
  p[1][0] = 0;
  p[1][1] = 2;
  p[1][2] = 1;
  p[2][0] = 1;
  p[2][1] = 0;
  p[2][2] = 2;
  p[3][0] = 1;
  p[3][1] = 2;
  p[3][2] = 0;
  p[4][0] = 2;
  p[4][1] = 0;
  p[4][2] = 1;
  p[5][0] = 2;
  p[5][1] = 1;
  p[5][2] = 0;
  c[0][0] = 1;
  c[0][1] = 2;
  c[0][2] = 3;
  for (int i = 1; i < 35; ++i) {
    if (c[i - 1][2] < 7) {
      c[i][0] = c[i - 1][0];
      c[i][1] = c[i - 1][1];
      c[i][2] = c[i - 1][2] + 1;
    } else if (c[i - 1][1] < 6) {
      c[i][0] = c[i - 1][0];
      c[i][1] = c[i - 1][1] + 1;
      c[i][2] = c[i][1] + 1;
    } else {
      c[i][0] = c[i - 1][0] + 1;
      c[i][1] = c[i][0] + 1;
      c[i][2] = c[i][1] + 1;
    }
  }
  for (int i = 0; i < 8; ++i) {
    cin >> xyz[i][0] >> xyz[i][1] >> xyz[i][2];
  }
  int num_mask = 1;
  for (int i = 0; i < 7; ++i) {
    num_mask = num_mask * 6;
  }
  xyz1[0][0] = xyz[0][0];
  xyz1[0][1] = xyz[0][1];
  xyz1[0][2] = xyz[0][2];
  for (int mask = 0; mask < num_mask; ++mask) {
    int mask_cur = mask;
    for (int i = 1; i < 8; ++i) {
      int p_num = mask_cur % 6;
      for (int j = 0; j < 3; ++j) {
        xyz1[i][j] = xyz[i][p[p_num][j]];
      }
      mask_cur /= 6;
    }
    for (int i = 1; i < 8; ++i) {
      for (int j = 0; j < 3; ++j) {
        vxyz_all[i][j] = xyz1[i][j] - xyz1[0][j];
      }
    }
    for (int i = 1; i < 8; ++i) {
      for (int j = 1; j < 8; ++j) {
        smult_all[i][j] = smult(vxyz_all[i], vxyz_all[j]);
      }
    }
    for (int mask1 = 0; mask1 < 35; ++mask1) {
      if (smult_all[c[mask1][0]][c[mask1][0]] == 0) continue;
      if (smult_all[c[mask1][0]][c[mask1][1]] != 0 ||
          smult_all[c[mask1][0]][c[mask1][2]] != 0 ||
          smult_all[c[mask1][1]][c[mask1][2]] != 0)
        continue;
      if (smult_all[c[mask1][0]][c[mask1][0]] !=
              smult_all[c[mask1][1]][c[mask1][1]] ||
          smult_all[c[mask1][0]][c[mask1][0]] !=
              smult_all[c[mask1][2]][c[mask1][2]])
        continue;
      for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
          vxyz[i][j] = vxyz_all[c[mask1][i]][j];
        }
      }
      for (int i = 0; i < 8; ++i) {
        int take[3];
        int cur_i = i;
        for (int j = 0; j < 3; ++j) {
          take[j] = cur_i % 2;
          cur_i /= 2;
        }
        xyz_cur[i][0] = xyz[0][0];
        xyz_cur[i][1] = xyz[0][1];
        xyz_cur[i][2] = xyz[0][2];
        for (int j = 0; j < 3; ++j) {
          if (take[j] == 1) {
            xyz_cur[i][0] += vxyz[j][0];
            xyz_cur[i][1] += vxyz[j][1];
            xyz_cur[i][2] += vxyz[j][2];
          }
        }
      }
      bool total_key = true;
      for (int i = 3; i < 8; ++i) {
        if (i != 4) {
          bool key = false;
          for (int j = 1; j < 8; ++j) {
            if (xyz1[j][0] == xyz_cur[i][0] && xyz1[j][1] == xyz_cur[i][1] &&
                xyz1[j][2] == xyz_cur[i][2]) {
              key = true;
              break;
            }
          }
          if (!key) {
            total_key = false;
            break;
          }
        }
      }
      if (total_key) {
        cout << "YES" << endl;
        for (int i = 0; i < 8; ++i) {
          cout << xyz1[i][0] << " " << xyz1[i][1] << " " << xyz1[i][2] << endl;
        }
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}