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-7;
bool is_int(double p, long long &val) {
  val = round(p);
  return fabs(val - p) < EPS;
}
struct point {
  long long x, y, z;
  point operator-(const point &o) {
    point res = {x - o.x, y - o.y, z - o.z};
    return res;
  }
  point operator+(const point &o) {
    point res = {x + o.x, y + o.y, z + o.z};
    return res;
  }
  bool operator==(const point &o) { return x == o.x && y == o.y && z == o.z; }
  void print() { printf("%d %d %d\n", (int)x, (int)y, (int)z); }
  bool normalize(long long d2) {
    double d = sqrt(d2);
    double nx = x / d, ny = y / d, nz = z / d;
    return is_int(nx, x) && is_int(ny, y) && is_int(nz, z);
  }
};
point points[8];
point zero = {0, 0, 0};
point answer[8];
bool used[5];
point goal[5];
long long dist(point p1, point p2) {
  return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y) +
         (p1.z - p2.z) * (p1.z - p2.z);
}
point perm(point p1, int pnum) {
  point res = p1;
  switch (pnum) {
    case 0:
      res = p1;
      break;
    case 1:
      res.x = p1.x;
      res.y = p1.z;
      res.z = p1.y;
      break;
    case 2:
      res.x = p1.y;
      res.y = p1.x;
      res.z = p1.z;
      break;
    case 3:
      res.x = p1.y;
      res.y = p1.z;
      res.z = p1.x;
      break;
    case 4:
      res.x = p1.z;
      res.y = p1.x;
      res.z = p1.y;
      break;
    case 5:
      res.x = p1.z;
      res.y = p1.y;
      res.z = p1.x;
      break;
  };
  return res;
}
point mul(point p1, point p2) {
  point res = {p1.y * p2.z - p1.z * p2.y, p1.z * p2.x - p1.x * p2.z,
               p1.x * p2.y - p1.y * p2.x};
  return res;
}
bool matches(point cur, point goal, point &res) {
  for (int i = 0; i < 6; i++) {
    res = perm(cur, i);
    if (res == goal) return true;
  }
  return false;
}
bool build_answer(int cur, int m1, int m2) {
  if (cur == 8) return true;
  if (cur == m1 || cur == m2) return build_answer(cur + 1, m1, m2);
  for (int i = 0; i < 5; i++) {
    if (used[i]) continue;
    if (matches(points[cur], goal[i], answer[cur])) {
      used[i] = true;
      if (build_answer(cur + 1, m1, m2)) return true;
      used[i] = false;
    }
  }
  return false;
}
int main() {
  for (int i = 0; i < 8; i++) {
    std::cin >> points[i].x >> points[i].y >> points[i].z;
  }
  for (int p1 = 1; p1 < 8; p1++) {
    for (int p2 = 1; p2 < 8; p2++) {
      if (p1 == p2) continue;
      for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 6; j++) {
          point A = points[0];
          point B = perm(points[p1], i);
          point C = perm(points[p2], j);
          if (dist(A, B) != dist(A, C)) continue;
          long long d2 = dist(A, B);
          point v1 = B - A;
          point v2 = C - A;
          point v3 = mul(v1, v2);
          if (!v3.normalize(d2)) continue;
          if (dist(v3, zero) == 0) continue;
          goal[0] = A + v1 + v2;
          goal[1] = A + v3;
          goal[2] = A + v1 + v3;
          goal[3] = A + v2 + v3;
          goal[4] = A + v1 + v2 + v3;
          answer[0] = A;
          answer[p1] = B;
          answer[p2] = C;
          if (build_answer(1, p1, p2)) {
            printf("YES\n");
            for (int z = 0; z < 8; z++)
              std::cout << answer[z].x << " " << answer[z].y << " "
                        << answer[z].z << std::endl;
            return 0;
          }
        }
      }
    }
  }
  printf("NO\n");
  return 0;
}