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 double EPS = 1e-9;
const double PI = acos(-1.0);
const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 2000 * 1000 * 1000;
long long sqr(int n) { return 1ll * n * n; }
struct Point {
  int x, y, z;
  Point() {}
  Point(const vector<int>& a) : x(a[0]), y(a[1]), z(a[2]) {}
  Point(int x, int y, int z) : x(x), y(y), z(z) {}
  Point operator+(const Point& p) const {
    return Point(x + p.x, y + p.y, z + p.z);
  }
  Point operator-(const Point& p) const {
    return Point(x - p.x, y - p.y, z - p.z);
  }
  bool operator==(const vector<int>& p) const {
    vector<int> temp(3);
    temp[0] = x, temp[1] = y, temp[2] = z;
    sort((temp).begin(), (temp).end());
    return p == temp;
  }
  bool operator<(const Point& p) const {
    if (x != p.x) return x < p.x;
    if (y != p.y) return y < p.y;
    return z < p.z;
  }
  bool operator!=(const Point& p) const { return *this < p || p < *this; }
  long long sqrlen() const { return sqr(x) + sqr(y) + sqr(z); }
  long long operator^(const Point& p) const {
    return 1ll * x * p.x + 1ll * y * p.y + 1ll * z * p.z;
  }
};
ostream& operator<<(ostream& c, const Point& p) {
  c << p.x << ' ' << p.y << ' ' << p.z;
  return c;
}
vector<int> a[8];
int p[4];
bool taken[8];
int cnt[8];
bool check_point(const Point& a, const Point& b, const Point& c) {
  long long lena = a.sqrlen();
  long long lenb = b.sqrlen();
  long long lenc = c.sqrlen();
  if (lena == 0 || lenb == 0 || lenc == 0) return false;
  if (lena != lenb || lenb != lenc || lenc != lena) return false;
  if (!(a != b && b != c && a != b)) return false;
  return (a ^ b) == 0 && (a ^ c) == 0 && (b ^ c) == 0;
}
void check() {
  Point ans[8];
  Point A(a[p[0]]);
  Point B(a[p[1]]);
  Point C(a[p[2]]);
  Point D(a[p[3]]);
  ans[p[0]] = A;
  ans[p[1]] = B;
  ans[p[2]] = C;
  ans[p[3]] = D;
  Point v1(B - A);
  Point v2(C - A);
  Point v3(D - A);
  if (!check_point(v1, v2, v3)) return;
  multiset<Point> st;
  st.insert(Point(A + v1 + v2));
  st.insert(Point(A + v1 + v3));
  st.insert(Point(A + v3 + v2));
  st.insert(Point(A + v1 + v2 + v3));
  for (int i = 0; i < 8; i++) {
    if (taken[i]) continue;
    for (set<Point>::iterator it = st.begin(); it != st.end(); it++) {
      if (*it == a[i]) {
        ans[i] = *it;
        st.erase(it);
        break;
      }
    }
  }
  if (st.empty()) {
    puts("YES");
    for (int i = 0; i < 8; i++) {
      cout << ans[i] << endl;
    }
    exit(0);
  }
}
void go(int pos) {
  if (pos == 4) {
    check();
    return;
  }
  for (int i = 0; i < 8; i++) {
    bool flag = true;
    for (int j = 0; j < pos && flag; j++) {
      if (i == p[j]) flag = false;
    }
    if (!flag) continue;
    p[pos] = i;
    taken[i] = true;
    do {
      go(pos + 1);
    } while (next_permutation((a[i]).begin(), (a[i]).end()));
    taken[i] = false;
    sort((a[i]).begin(), (a[i]).end());
  }
}
int main() {
  for (int i = 0; i < 8; i++) {
    a[i].resize(3);
    for (int j = 0; j < 3; j++) {
      scanf("%d", &a[i][j]);
    }
    sort((a[i]).begin(), (a[i]).end());
  }
  go(0);
  puts("NO");
  return 0;
}