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;
long long pointDistance(tuple<long long, long long, long long> a,
                        tuple<long long, long long, long long> b) {
  return (get<0>(a) - get<0>(b)) * (get<0>(a) - get<0>(b)) +
         (get<1>(a) - get<1>(b)) * (get<1>(a) - get<1>(b)) +
         (get<2>(a) - get<2>(b)) * (get<2>(a) - get<2>(b));
}
long long dotProduct(tuple<long long, long long, long long> a,
                     tuple<long long, long long, long long> b) {
  return get<0>(a) * get<0>(b) + get<1>(a) * get<1>(b) + get<2>(a) * get<2>(b);
}
tuple<long long, long long, long long> displacement(
    tuple<long long, long long, long long> a,
    tuple<long long, long long, long long> b) {
  return {get<0>(b) - get<0>(a), get<1>(b) - get<1>(a), get<2>(b) - get<2>(a)};
}
bool isCube(const vector<tuple<long long, long long, long long>>& points) {
  map<long long, int> countDistances;
  for (int i = 0; i < 8; i++) {
    for (int j = i + 1; j < 8; j++) {
      tuple<long long, long long, long long> p1 = points[i];
      tuple<long long, long long, long long> p2 = points[j];
      long long delta = pointDistance(p1, p2);
      countDistances[delta]++;
    }
  }
  auto lSq = countDistances.begin()->first;
  if (countDistances.count(lSq) == 0 || countDistances[lSq] != 12) {
    return false;
  }
  if (countDistances.count(2 * lSq) == 0 || countDistances[2 * lSq] != 12) {
    return false;
  }
  if (countDistances.count(3 * lSq) == 0 || countDistances[3 * lSq] != 4) {
    return false;
  }
  return true;
}
int x, y, z;
int getIdx(tuple<long long, long long, long long> p, int idx) {
  if (idx == 0) return get<0>(p);
  if (idx == 1) return get<1>(p);
  if (idx == 2) return get<2>(p);
  return -1;
}
tuple<long long, long long, long long> permutePoint(
    tuple<long long, long long, long long> p, tuple<int, int, int> permute) {
  return tuple<long long, long long, long long>(getIdx(p, get<0>(permute)),
                                                getIdx(p, get<1>(permute)),
                                                getIdx(p, get<2>(permute)));
}
int main() {
  vector<tuple<long long, long long, long long>> points;
  for (int i = 0; i < 8; i++) {
    cin >> x >> y >> z;
    points.emplace_back(x, y, z);
  }
  vector<tuple<int, int, int>> permute = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2},
                                          {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
  vector<tuple<long long, long long, long long>> permutedPoints;
  for (const auto permute1 : permute) {
    for (const auto permute2 : permute) {
      for (const auto permute3 : permute) {
        for (const auto permute4 : permute) {
          for (const auto permute5 : permute) {
            for (const auto permute6 : permute) {
              for (const auto permute7 : permute) {
                permutedPoints.clear();
                permutedPoints.push_back(points[0]);
                permutedPoints.push_back(permutePoint(points[1], permute1));
                permutedPoints.push_back(permutePoint(points[2], permute2));
                permutedPoints.push_back(permutePoint(points[3], permute3));
                permutedPoints.push_back(permutePoint(points[4], permute4));
                permutedPoints.push_back(permutePoint(points[5], permute5));
                permutedPoints.push_back(permutePoint(points[6], permute6));
                permutedPoints.push_back(permutePoint(points[7], permute7));
                if (isCube(permutedPoints)) {
                  cout << "YES" << endl;
                  for (const auto pp : permutedPoints) {
                    cout << get<0>(pp) << " " << get<1>(pp) << " " << get<2>(pp)
                         << endl;
                  }
                  return 0;
                }
              }
            }
          }
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}