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;
class vec3 {
 public:
  long long x, y, z;
  vec3() {}
  vec3(long long x, long long y, long long z) : x(x), y(y), z(z) {}
};
vec3 operator+(vec3 a, vec3 b) { return vec3(a.x + b.x, a.y + b.y, a.z + b.z); }
vec3 operator-(vec3 a, vec3 b) { return vec3(a.x - b.x, a.y - b.y, a.z - b.z); }
bool operator==(vec3 a, vec3 b) {
  return a.x == b.x && a.y == b.y && a.z == b.z;
}
vec3 perm(vec3 v, int i) {
  switch (i) {
    case 0:
      return vec3(v.x, v.y, v.z);
    case 1:
      return vec3(v.x, v.z, v.y);
    case 2:
      return vec3(v.y, v.x, v.z);
    case 3:
      return vec3(v.y, v.z, v.x);
    case 4:
      return vec3(v.z, v.x, v.y);
    case 5:
      return vec3(v.z, v.y, v.x);
    default:
      assert(false);
  }
}
long long dot(vec3 a, vec3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
long long len2(vec3 a) { return dot(a, a); }
bool rect(vec3 a, vec3 b, vec3 c) { return dot(b - a, c - a) == 0; }
bool cube(vec3 o, vec3 x, vec3 y, vec3 z) {
  if (!rect(o, x, y)) return false;
  if (!rect(o, y, z)) return false;
  if (!rect(o, z, x)) return false;
}
void operator>>(istream& in, vec3& v) { in >> v.x >> v.y >> v.z; }
void operator<<(ostream& out, const vec3& v) {
  out << v.x << " " << v.y << " " << v.z << endl;
}
vec3 v[8];
bool find(vec3 j, int* p) {
  for (int i = 0; i < 8; i++) {
    if (p[i] != -1) continue;
    for (int pp = 0; pp < 6; pp++) {
      if (perm(v[i], pp) == j) {
        p[i] = pp;
        return true;
      }
    }
  }
  return false;
}
int main() {
  for (int i = 0; i < 8; i++) cin >> v[i];
  for (int o = 0; o < 8; o++) {
    for (int x = 0; x < 8; x++) {
      if (x == o) continue;
      for (int px = 0; px < 6; px++) {
        long long side = len2(v[o] - perm(v[x], px));
        if (side == 0) continue;
        for (int y = 0; y < 8; y++) {
          if (y == o || y == x) continue;
          for (int py = 0; py < 6; py++) {
            if (side != len2(v[o] - perm(v[y], py))) continue;
            if (!rect(v[o], perm(v[x], px), perm(v[y], py))) continue;
            for (int z = 0; z < 8; z++) {
              if (z == o || z == x || z == y) continue;
              for (int pz = 0; pz < 6; pz++) {
                if (side != len2(v[o] - perm(v[z], pz))) continue;
                if (!rect(v[o], perm(v[x], px), perm(v[z], pz))) continue;
                if (!rect(v[o], perm(v[y], py), perm(v[z], pz))) continue;
                int p[8];
                for (int i = 0; i < 8; i++) p[i] = -1;
                p[o] = 0;
                p[x] = px;
                p[y] = py;
                p[z] = pz;
                if (!find(perm(v[x], px) + perm(v[y], py) - v[o], p)) continue;
                if (!find(perm(v[x], px) + perm(v[z], pz) - v[o], p)) continue;
                if (!find(perm(v[y], py) + perm(v[z], pz) - v[o], p)) continue;
                if (!find(perm(v[x], px) + perm(v[y], py) + perm(v[z], pz) -
                              v[o] - v[o],
                          p))
                  continue;
                cout << "YES" << endl;
                for (int i = 0; i < 8; i++) cout << perm(v[i], p[i]);
                return 0;
              }
            }
          }
        }
      }
    }
  }
  cout << "NO" << endl;
}