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;
int input[8][3];
int point[8][3];
inline long long dist(pair<int, pair<int, int> > a) {
  return (long long)a.first * a.first +
         (long long)a.second.first * a.second.first +
         (long long)a.second.second * a.second.second;
}
inline bool perpendicular(pair<int, pair<int, int> > a,
                          pair<int, pair<int, int> > b) {
  return !((long long)a.first * b.first +
           (long long)a.second.first * b.second.first +
           (long long)a.second.second * b.second.second);
}
inline bool cmp(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
  return dist(a) < dist(b);
}
bool iscube() {
  pair<int, pair<int, int> > calcpoint[8];
  for (int i = 0; i < 8; i++) {
    calcpoint[i].first = point[i][0] - point[0][0];
    calcpoint[i].second.first = point[i][1] - point[0][1];
    calcpoint[i].second.second = point[i][2] - point[0][2];
  }
  sort(calcpoint, calcpoint + 8, cmp);
  if (dist(calcpoint[1]) == 0) return false;
  if (dist(calcpoint[1]) != dist(calcpoint[2])) return false;
  if (dist(calcpoint[2]) != dist(calcpoint[3])) return false;
  if (dist(calcpoint[3]) != dist(calcpoint[1])) return false;
  if (!perpendicular(calcpoint[1], calcpoint[2])) return false;
  if (!perpendicular(calcpoint[2], calcpoint[3])) return false;
  if (!perpendicular(calcpoint[3], calcpoint[1])) return false;
  pair<int, pair<int, int> > p12, p23, p31, p123;
  p12.first = calcpoint[1].first + calcpoint[2].first;
  p12.second.first = calcpoint[1].second.first + calcpoint[2].second.first;
  p12.second.second = calcpoint[1].second.second + calcpoint[2].second.second;
  p23.first = calcpoint[2].first + calcpoint[3].first;
  p23.second.first = calcpoint[2].second.first + calcpoint[3].second.first;
  p23.second.second = calcpoint[2].second.second + calcpoint[3].second.second;
  p31.first = calcpoint[3].first + calcpoint[1].first;
  p31.second.first = calcpoint[3].second.first + calcpoint[1].second.first;
  p31.second.second = calcpoint[3].second.second + calcpoint[1].second.second;
  p123.first = calcpoint[1].first + calcpoint[2].first + calcpoint[3].first;
  p123.second.first = calcpoint[1].second.first + calcpoint[2].second.first +
                      calcpoint[3].second.first;
  p123.second.second = calcpoint[1].second.second + calcpoint[2].second.second +
                       calcpoint[3].second.second;
  if (p123 != calcpoint[7]) return false;
  if (p12 != calcpoint[4] && p12 != calcpoint[5] && p12 != calcpoint[6])
    return false;
  if (p23 != calcpoint[4] && p23 != calcpoint[5] && p23 != calcpoint[6])
    return false;
  if (p31 != calcpoint[4] && p31 != calcpoint[5] && p31 != calcpoint[6])
    return false;
  return true;
}
void bktk(int n) {
  if (n == 8) {
    if (iscube()) {
      printf("YES");
      for (int i = 0; i < 8; i++)
        printf("\n%d %d %d", point[i][0], point[i][1], point[i][2]);
      exit(0);
    }
    return;
  }
  point[n][0] = input[n][0];
  point[n][1] = input[n][1];
  point[n][2] = input[n][2];
  bktk(n + 1);
  point[n][0] = input[n][0];
  point[n][1] = input[n][2];
  point[n][2] = input[n][1];
  bktk(n + 1);
  point[n][0] = input[n][1];
  point[n][1] = input[n][0];
  point[n][2] = input[n][2];
  bktk(n + 1);
  point[n][0] = input[n][1];
  point[n][1] = input[n][2];
  point[n][2] = input[n][0];
  bktk(n + 1);
  point[n][0] = input[n][2];
  point[n][1] = input[n][0];
  point[n][2] = input[n][1];
  bktk(n + 1);
  point[n][0] = input[n][2];
  point[n][1] = input[n][1];
  point[n][2] = input[n][0];
  bktk(n + 1);
}
int main() {
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 3; j++) scanf("%d", &input[i][j]);
  point[0][0] = input[0][0];
  point[0][1] = input[0][1];
  point[0][2] = input[0][2];
  bktk(1);
  printf("NO");
}