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;
int ord[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2},
                 {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
bool solved = false;
struct Point {
  long long v[3];
  long long mod2() { return v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; }
  Point order(int o) {
    Point b;
    b.v[0] = v[ord[o][0]];
    b.v[1] = v[ord[o][1]];
    b.v[2] = v[ord[o][2]];
    return b;
  }
  void print() { printf("(%lld %lld %lld)\n", v[0], v[1], v[2]); }
};
Point operator+(Point a, Point b) {
  Point c;
  c.v[0] = a.v[0] + b.v[0];
  c.v[1] = a.v[1] + b.v[1];
  c.v[2] = a.v[2] + b.v[2];
  return c;
}
Point operator-(Point a, Point b) {
  Point c;
  c.v[0] = a.v[0] - b.v[0];
  c.v[1] = a.v[1] - b.v[1];
  c.v[2] = a.v[2] - b.v[2];
  return c;
}
long long prod(Point a, Point b) {
  return a.v[0] * b.v[0] + a.v[1] * b.v[1] + a.v[2] * b.v[2];
}
Point a[8];
Point b[8];
int p[8];
int used[8];
Point v01, v02, v03, v14, v24, v15, v35, v26, v36, v47, v57, v67, v07;
long long m01;
void rec1();
void rec2();
void rec3();
void rec4();
void rec5();
void rec6();
void rec7();
void rec1() {
  for (p[1] = 1; p[1] < 8; ++p[1]) {
    for (int o1 = 0; o1 < 6; ++o1) {
      b[1] = a[p[1]].order(o1);
      v01 = b[1] - b[0];
      m01 = v01.mod2();
      if (m01 == 0) continue;
      used[p[1]] = 1;
      rec2();
      used[p[1]] = 0;
      if (solved) return;
    }
  }
}
void rec2() {
  for (p[2] = p[1] + 1; p[2] < 8; ++p[2]) {
    for (int o2 = 0; o2 < 6; ++o2) {
      b[2] = a[p[2]].order(o2);
      v02 = b[2] - b[0];
      if (prod(v01, v02) != 0) continue;
      if (v02.mod2() != m01) continue;
      used[p[2]] = 1;
      rec3();
      used[p[2]] = 0;
      if (solved) return;
    }
  }
}
void rec3() {
  for (p[3] = p[2] + 1; p[3] < 8; ++p[3]) {
    for (int o3 = 0; o3 < 6; ++o3) {
      b[3] = a[p[3]].order(o3);
      v03 = b[3] - b[0];
      if (prod(v01, v03) != 0) continue;
      if (prod(v02, v03) != 0) continue;
      if (v03.mod2() != m01) continue;
      used[p[3]] = 1;
      rec4();
      used[p[3]] = 0;
      if (solved) return;
    }
  }
}
void rec4() {
  for (p[4] = 1; p[4] < 8; ++p[4]) {
    if (used[p[4]]) continue;
    for (int o4 = 0; o4 < 6; ++o4) {
      b[4] = a[p[4]].order(o4);
      v14 = b[4] - b[1];
      v24 = b[4] - b[2];
      if (prod(v01, v14) != 0) continue;
      if (prod(v02, v24) != 0) continue;
      if (v14.mod2() != m01) continue;
      if (v24.mod2() != m01) continue;
      used[p[4]] = 1;
      rec5();
      used[p[4]] = 0;
      if (solved) return;
    }
  }
}
void rec5() {
  for (p[5] = 1; p[5] < 8; ++p[5]) {
    if (used[p[5]]) continue;
    for (int o5 = 0; o5 < 6; ++o5) {
      b[5] = a[p[5]].order(o5);
      v15 = b[5] - b[1];
      v35 = b[5] - b[3];
      if (prod(v01, v15) != 0) continue;
      if (prod(v03, v35) != 0) continue;
      if (v15.mod2() != m01) continue;
      if (v35.mod2() != m01) continue;
      used[p[5]] = 1;
      rec6();
      used[p[5]] = 0;
      if (solved) return;
    }
  }
}
void rec6() {
  for (p[6] = 1; p[6] < 8; ++p[6]) {
    if (used[p[6]]) continue;
    for (int o6 = 0; o6 < 6; ++o6) {
      b[6] = a[p[6]].order(o6);
      v26 = b[6] - b[2];
      v36 = b[6] - b[3];
      if (prod(v02, v26) != 0) continue;
      if (prod(v03, v36) != 0) continue;
      if (v26.mod2() != m01) continue;
      if (v36.mod2() != m01) continue;
      used[p[6]] = 1;
      rec7();
      used[p[6]] = 0;
      if (solved) return;
    }
  }
}
void rec7() {
  for (p[7] = 1; p[7] < 8; ++p[7]) {
    if (used[p[7]]) continue;
    for (int o7 = 0; o7 < 6; ++o7) {
      b[7] = a[p[7]].order(o7);
      v07 = b[7] - b[0];
      v47 = b[7] - b[4];
      v57 = b[7] - b[5];
      v67 = b[7] - b[6];
      if (prod(v47, v57) != 0) continue;
      if (prod(v57, v67) != 0) continue;
      if (prod(v47, v67) != 0) continue;
      if (v47.mod2() != m01) continue;
      if (v57.mod2() != m01) continue;
      if (v67.mod2() != m01) continue;
      if (v07.mod2() != 3 * m01) continue;
      solved = true;
      return;
    }
  }
}
int main() {
  for (int i = 0; i < 8; ++i) {
    scanf("%lld%lld%lld", &(a[i].v[0]), &(a[i].v[1]), &(a[i].v[2]));
  }
  b[0] = a[0];
  p[0] = 0;
  rec1();
  if (solved) {
    for (int i = 0; i < 8; ++i) {
      a[p[i]] = b[i];
    }
    printf("YES\n");
    for (int i = 0; i < 8; ++i) {
      printf("%lld %lld %lld\n", a[i].v[0], a[i].v[1], a[i].v[2]);
    }
  } else {
    printf("NO\n");
  }
  return 0;
}