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 int maxn = 100;
vector<vector<long long> > v[maxn];
vector<long long> a, u, cur[maxn];
int now[maxn], n = 8, cnt[maxn];
long long val(long long x) {
  if (x > 0) return x;
  return -x;
}
long long fas(long long x1, long long y1, long long z1, long long x2,
              long long y2, long long z2) {
  long long q = val(x1 - x2);
  long long w = val(y1 - y2);
  long long e = val(z1 - z2);
  q = q * q, w = w * w, e = e * e;
  return q + w + e;
}
bool check() {
  for (int i = 0; i < n; i++) cur[i] = v[i][now[i]];
  long long minn = 1e17;
  for (int i = 0; i < n; i++) {
    long long x1 = cur[i][0], y1 = cur[i][1], z1 = cur[i][2];
    for (int j = i + 1; j < n; j++) {
      long long x2 = cur[j][0], y2 = cur[j][1], z2 = cur[j][2];
      minn = min(minn, (fas(x1, y1, z1, x2, y2, z2)));
    }
  }
  cnt[1] = 0, cnt[2] = 0, cnt[3] = 0;
  for (int i = 0; i < n; i++) {
    long long x1 = cur[i][0], y1 = cur[i][1], z1 = cur[i][2];
    for (int j = i + 1; j < n; j++) {
      long long x2 = cur[j][0], y2 = cur[j][1], z2 = cur[j][2];
      long long cur = (fas(x1, y1, z1, x2, y2, z2));
      if (cur != minn && cur != 2 * minn && cur != 3 * minn)
        return false;
      else if (cur == 2 * minn)
        cnt[2]++;
      else if (cur == minn)
        cnt[1]++;
      else
        cnt[3]++;
    }
  }
  if (cnt[1] == 12 && cnt[2] == 12 && cnt[3] == 4) return true;
  return false;
}
void go_next() {
  for (int i = n - 1; i >= 0; i--) {
    int kol = v[i].size() - 1;
    if (kol != now[i]) {
      now[i]++;
      for (int j = i + 1; j < n; j++) now[j] = 0;
      return;
    }
  }
}
int main() {
  for (int i = 0; i < n; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    a.clear();
    a.push_back(x), a.push_back(y), a.push_back(z);
    sort(a.begin(), a.end());
    v[i].push_back(a);
    while (next_permutation(a.begin(), a.end())) {
      v[i].push_back(a);
    }
  }
  int tot = 1;
  for (int i = 0; i < n; i++) tot *= v[i].size();
  for (int i = 0; i < n; i++) now[i] = 0;
  for (int i = 0; i < tot + 5; i++) {
    bool res = check();
    if (res) {
      cout << "YES"
           << "\n";
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < v[i][now[i]].size(); j++)
          cout << v[i][now[i]][j] << " ";
        cout << "\n";
      }
      return 0;
    }
    go_next();
  }
  cout << "NO" << endl;
  return 0;
}