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;
vector<pair<int, pair<int, int> > > a;
vector<pair<int, pair<int, int> > > b;
vector<pair<int, int> > x, y, z;
void isHere(vector<pair<int, int> > &a, int x) {
  for (int i = 0; i < a.size(); i++) {
    if (a[i].first == x) {
      a[i].second++;
      return;
    }
  }
  a.push_back(make_pair(x, 1));
}
long long d(long long x1, long long y1, long long z1, long long x2,
            long long y2, long long z2) {
  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1);
}
long long vect(long long x1, long long y1, long long z1, long long x2,
               long long y2, long long z2) {
  return x2 * x1 + y2 * y1 + z2 * z1;
}
bool check(vector<pair<int, pair<int, int> > > a) {
  for (int i = 0; i < 7; i++) {
    for (int j = i + 1; j < 8; j++) {
      if (a[i] == a[j]) {
        return false;
      }
    }
  }
  long long l = 1000000007;
  l *= 1000000007;
  for (int i = 0; i < 7; i++) {
    for (int j = i + 1; j < 8; j++) {
      l = min(l, d(a[i].first, a[i].second.first, a[i].second.second,
                   a[j].first, a[j].second.first, a[j].second.second));
    }
  }
  for (int i = 0; i < 8; i++) {
    int p = 0;
    vector<pair<int, pair<int, int> > > z;
    for (int j = 0; j < 8; j++) {
      if (l == d(a[i].first, a[i].second.first, a[i].second.second, a[j].first,
                 a[j].second.first, a[j].second.second)) {
        p++;
        z.push_back(
            make_pair(a[j].first - a[i].first,
                      make_pair(a[j].second.first - a[i].second.first,
                                a[j].second.second - a[i].second.second)));
      }
    }
    if (p != 3) {
      return false;
    } else {
      for (int i = 0; i < 2; i++) {
        for (int j = i + 1; j < 3; j++) {
          if (vect(z[i].first, z[i].second.first, z[i].second.second,
                   z[j].first, z[j].second.first, z[j].second.second) != 0) {
            return false;
          }
        }
      }
    }
  }
  return true;
}
void showR(vector<pair<int, pair<int, int> > > a) {
  cout << "YES" << endl;
  for (int i = 0; i < 8; i++) {
    cout << a[i].first << " " << a[i].second.first << " " << a[i].second.second
         << endl;
  }
}
void make_b(int i, int k) {
  if (k == 0) {
    b[i] = a[i];
    return;
  }
  if (k == 1) {
    b[i].first = a[i].first;
    b[i].second.first = a[i].second.second;
    b[i].second.second = a[i].second.first;
  }
  if (k == 2) {
    b[i].first = a[i].second.second;
    b[i].second.first = a[i].first;
    b[i].second.second = a[i].second.first;
  }
  if (k == 3) {
    b[i].first = a[i].second.second;
    b[i].second.first = a[i].second.first;
    b[i].second.second = a[i].first;
  }
  if (k == 4) {
    b[i].first = a[i].second.first;
    b[i].second.first = a[i].first;
    b[i].second.second = a[i].second.second;
  }
  if (k == 5) {
    b[i].first = a[i].second.first;
    b[i].second.first = a[i].second.second;
    b[i].second.second = a[i].first;
  }
}
int main() {
  srand(time(NULL));
  for (int i = 0; i < 8; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    a.push_back(make_pair(x, make_pair(y, z)));
  }
  for (int i = 0; i < a.size(); i++) {
    b.push_back(a[i]);
  }
  for (int j = 0; j < 6; j++) {
    for (int z = 0; z < 6; z++) {
      for (int k = 0; k < 6; k++) {
        for (int p = 0; p < 6; p++) {
          for (int g = 0; g < 6; g++) {
            for (int e = 0; e < 6; e++) {
              for (int h = 0; h < 6; h++) {
                if (j == 3 && z == 4 && k == 1 && p == 4 && g == 0 && e == 3 &&
                    h == 1) {
                  h = 1;
                }
                make_b(0, 0);
                make_b(1, j);
                make_b(2, z);
                make_b(3, k);
                make_b(4, p);
                make_b(5, g);
                make_b(6, e);
                make_b(7, h);
                if (check(b)) {
                  showR(b);
                  return 0;
                }
              }
            }
          }
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}