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 long mod = 1000000007;
struct point {
  long long x;
  long long y;
  long long z;
};
point pt[8];
long long dst[8];
long long dst2[8];
long long dst3[8];
inline double get_dist(int i, int j) {
  long long ans = (pt[j].x - pt[i].x) * (pt[j].x - pt[i].x);
  ans += (pt[j].y - pt[i].y) * (pt[j].y - pt[i].y);
  ans += (pt[j].z - pt[i].z) * (pt[j].z - pt[i].z);
  return ans;
}
inline bool is_differ() {
  for (int i = 0; i < 8; ++i)
    for (int j = i + 1; j < 8; ++j) {
      if (pt[i].x == pt[j].x && pt[i].y == pt[j].y && pt[i].z == pt[j].z)
        return false;
    }
  return true;
}
inline bool check() {
  for (int i = 0; i < 8; ++i) dst2[i] = dst[i] = get_dist(i, 7);
  sort(dst, dst + 8);
  long long a2 = dst[1];
  if (a2 != dst[2] || a2 != dst[3]) return false;
  if (2 * a2 != dst[4] || 2 * a2 != dst[5] || 2 * a2 != dst[6]) return false;
  if (3 * a2 != dst[7]) return false;
  int ind = 0;
  for (int i = 0; i < 8; ++i)
    if (dst2[i] == 3 * a2) {
      ind = i;
      break;
    }
  for (int i = 0; i < 8; ++i) {
    dst3[i] = get_dist(i, ind);
    if (dst3[i] + dst2[i] != 3 * a2) return false;
  }
  return true;
}
void solve() {
  for (int i = 0; i < 8; ++i) cin >> pt[i].x >> pt[i].y >> pt[i].z;
  for (int s1 = 0; s1 < 6; ++s1) {
    for (int s2 = 0; s2 < 6; ++s2) {
      for (int s3 = 0; s3 < 6; ++s3) {
        for (int s4 = 0; s4 < 6; ++s4) {
          for (int s5 = 0; s5 < 6; ++s5) {
            for (int s6 = 0; s6 < 6; ++s6) {
              for (int s7 = 0; s7 < 6; ++s7) {
                if (is_differ() && check()) {
                  cout << "YES\n";
                  for (int i = 0; i < 8; ++i) {
                    cout << pt[i].x << " " << pt[i].y << " " << pt[i].z << endl;
                  }
                  return;
                }
                if (s7 & 1)
                  swap(pt[6].x, pt[6].y);
                else
                  swap(pt[6].z, pt[6].y);
              }
              if (s6 & 1)
                swap(pt[5].x, pt[5].y);
              else
                swap(pt[5].z, pt[5].y);
            }
            if (s5 & 1)
              swap(pt[4].x, pt[4].y);
            else
              swap(pt[4].z, pt[4].y);
          }
          if (s4 & 1)
            swap(pt[3].x, pt[3].y);
          else
            swap(pt[3].z, pt[3].y);
        }
        if (s3 & 1)
          swap(pt[2].x, pt[2].y);
        else
          swap(pt[2].z, pt[2].y);
      }
      if (s2 & 1)
        swap(pt[1].x, pt[1].y);
      else
        swap(pt[1].z, pt[1].y);
    }
    if (s1 & 1)
      swap(pt[0].x, pt[0].y);
    else
      swap(pt[0].z, pt[0].y);
  }
  if (is_differ() && check()) {
    cout << "YES\n";
    for (int i = 0; i < 8; ++i) {
      cout << pt[i].x << " " << pt[i].y << " " << pt[i].z << endl;
    }
    return;
  }
  cout << "NO\n";
}
int main() {
  std::ios_base::sync_with_stdio(false);
  solve();
  return 0;
}