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;
struct debug_t {
  template <typename T>
  debug_t& operator<<(const T& value) {
    return *this;
  }
} debug;
struct Point {
  int x, y, z;
  Point() {}
  Point(const Point& p) : x(p.x), y(p.y), z(p.z) {}
  Point(int x, int y, int z) : x(x), y(y), z(z) {}
  double sqr_dist(const Point& p) const {
    return ((p.x - double(x)) * (p.x - double(x))) +
           ((p.y - double(y)) * (p.y - double(y))) +
           ((p.z - double(z)) * (p.z - double(z)));
  }
  double dist(const Point& p) const { return sqrt(sqr_dist(p)); }
  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 Point& p) const {
    return x == p.x && y == p.y && z == p.z;
  }
};
bool is_cube(vector<Point>& p) {
  for (int i = 1; i < int((p).size()) - 1; i++)
    for (int j = i + 1; j < int((p).size()); j++)
      if (p[i].sqr_dist(p[0]) > p[j].sqr_dist(p[0])) swap(p[i], p[j]);
  for (int i = 0; i < (8); ++i)
    for (int j = 0; j < (8); ++j)
      if (i != j && p[i] == p[j]) return false;
  double a, b, c;
  a = p[0].sqr_dist(p[1]);
  b = p[0].sqr_dist(p[2]);
  c = p[0].sqr_dist(p[3]);
  if (!(((a) > (b) ? (a) - (b) : (b) - (a)) <= 1e-8) ||
      !(((b) > (c) ? (b) - (c) : (c) - (b)) <= 1e-8) ||
      !(((a) > (c) ? (a) - (c) : (c) - (a)) <= 1e-8))
    return false;
  Point aa((p[1] - p[0]) + (p[2] - p[0]) + p[0]);
  Point bb((p[2] - p[0]) + (p[3] - p[0]) + p[0]);
  Point cc((p[1] - p[0]) + (p[3] - p[0]) + p[0]);
  if (find((p).begin(), (p).end(), aa) == p.end() ||
      find((p).begin(), (p).end(), bb) == p.end() ||
      find((p).begin(), (p).end(), cc) == p.end()) {
    return false;
  }
  a = p[0].sqr_dist(aa);
  b = p[0].sqr_dist(bb);
  c = p[0].sqr_dist(cc);
  if (!(((a) > (b) ? (a) - (b) : (b) - (a)) <= 1e-8) ||
      !(((b) > (c) ? (b) - (c) : (c) - (b)) <= 1e-8) ||
      !(((a) > (c) ? (a) - (c) : (c) - (a)) <= 1e-8))
    return false;
  a = p[7].sqr_dist(aa);
  b = p[7].sqr_dist(bb);
  c = p[7].sqr_dist(cc);
  if (!(((a) > (b) ? (a) - (b) : (b) - (a)) <= 1e-8) ||
      !(((b) > (c) ? (b) - (c) : (c) - (b)) <= 1e-8) ||
      !(((a) > (c) ? (a) - (c) : (c) - (a)) <= 1e-8))
    return false;
  return true;
}
bool is_cube(const vector<vector<int> >& coord,
             const vector<vector<int> >& perm) {
  vector<Point> t(8);
  for (int i = 0; i < (8); ++i) {
    t[i].x = coord[i][perm[i][0]];
    t[i].y = coord[i][perm[i][1]];
    t[i].z = coord[i][perm[i][2]];
  }
  return is_cube(t);
}
void nxt_perm(vector<vector<int> >& perm, int pos = 7) {
  if (pos < 0) return;
  next_permutation((perm[pos]).begin(), (perm[pos]).end());
  if (perm[pos][0] == 0 && perm[pos][1] == 1 && perm[pos][2] == 2)
    nxt_perm(perm, pos - 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  while (true) {
    vector<vector<int> > cur(8, vector<int>(3));
    bool inp_ok = true;
    for (int i = 0; i < (8); ++i)
      for (int j = 0; j < (3); ++j)
        if (!(cin >> cur[i][j])) {
          inp_ok = false;
        }
    if (!inp_ok) break;
    vector<vector<int> > perm(8, vector<int>(3));
    for (int i = 0; i < (8); ++i)
      for (int j = 0; j < (3); ++j) perm[i][j] = j;
    bool solution_ex = false;
    int cnt = 6 * 6 * 6 * 6 * 6 * 6 * 6 * 6;
    for (int mask = 0; mask < (cnt); ++mask) {
      if (is_cube(cur, perm)) {
        cout << "YES"
             << "\n";
        for (int i = 0; i < (8); ++i) {
          for (int j = 0; j < (3); ++j) cout << cur[i][perm[i][j]] << " ";
          cout << "\n";
        }
        solution_ex = true;
        break;
      }
      nxt_perm(perm);
    }
    if (!solution_ex)
      cout << "NO"
           << "\n";
  }
  return 0;
}