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 JAVA):

Solution:
import java.util.HashSet;
import java.util.Scanner;

public class Main2 {
	static int[][] permutations = new int[6][3];
	static int points = 8;
	static int dimensions = 3;
	static int pCount;
	static int[][] c;
	static boolean finito = false;
	static HashSet<Double> tried;
	
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		tried= new HashSet<Double>();
		finito = false;
		c = new int[points][dimensions];
		for (int i = 0; i < points; i++) {
			for (int j = 0; j < dimensions; j++) {
				c[i][j] = sc.nextInt();
			}
		}

		permutations[0] = new int[] { 0, 1, 2 };
		permutations[1] = new int[] { 0, 2, 1 };
		permutations[2] = new int[] { 1, 0, 2 };
		permutations[3] = new int[] { 1, 2, 0 };
		permutations[4] = new int[] { 2, 0, 1 };
		permutations[5] = new int[] { 2, 1, 0 };

		pCount = permutations.length;
		double[][][] dist = new double[points][points][pCount * pCount];

		for (int i = 0; i < points; i++) {
			for (int j = i + 1; j < points; j++) {
				for (int j2 = 0; j2 < pCount; j2++) {
					for (int k = 0; k < pCount; k++) {

						int[] p1 = new int[3];
						p1[permutations[j2][0]] = c[i][0];
						p1[permutations[j2][1]] = c[i][1];
						p1[permutations[j2][2]] = c[i][2];

						int[] p2 = new int[3];
						p2[permutations[k][0]] = c[j][0];
						p2[permutations[k][1]] = c[j][1];
						p2[permutations[k][2]] = c[j][2];

						double d = dist(p1, p2);
						int dind = j2 * pCount + k;
						dist[i][j][dind] = d;
						dist[j][i][dind] = d;
					}
				}
			}
		}

		for (int i = 0; i < dist[0][0].length; i++) {
			double[] sides = getSides(dist[0][1][i]);

			if (sides[0] > 0 && !tried.contains(sides[0])) {
				rec(0, 1, dist, sides, new int[points]);
				tried.add(sides[0]);
			}
			
			sides = getSides(dist[0][1][i]/Math.sqrt(2));

			if (sides[0] > 0 && !tried.contains(sides[0])) {
				rec(0, 1, dist, sides, new int[points]);
				tried.add(sides[0]);
			}
			
			sides = getSides(dist[0][1][i]/Math.sqrt(3));

			if (sides[0] > 0 && !tried.contains(sides[0])) {
				rec(0, 1, dist, sides, new int[points]);
				tried.add(sides[0]);
			}
		}

		if(!finito)
			System.out.println("NO");
	}
	
	static double[] getSides(double side) {
		return new double[] { side, Math.sqrt(2) * side, Math.sqrt(3) * side };
	}

	static void rec(int p1, int p2, double[][][] dist, double[] sides,
			int[] perm) {
		if (finito)
			return;
		
		if (p1 >= points) {
			// check cube

			boolean ok = true;

			int[] sidec = new int[3];
			for (int i = 0; i < points; i++) {
				for (int j = i + 1; j < points; j++) {

//					int[] point1 = new int[3];
//					point1[permutations[perm[i]][0]] = c[i][0];
//					point1[permutations[perm[i]][1]] = c[i][1];
//					point1[permutations[perm[i]][2]] = c[i][2];
//					
//					int[] point2 = new int[3];
//					point2[permutations[perm[j]][0]] = c[j][0];
//					point2[permutations[perm[j]][1]] = c[j][1];
//					point2[permutations[perm[j]][2]] = c[j][2];
					
//					double d = dist(point1, point2);
 
					double d = dist[i][j][perm[i] * pCount + perm[j]];
					
					if (equal(sides[0], d))
						sidec[0]++;

					else if (equal(sides[1], d))
						sidec[1]++;

					else if (equal(sides[2], d))
						sidec[2]++;
					
					else 
						return;
				}
			}

			if (sidec[0] == 12 && sidec[1] == 12 && sidec[2] == 4) {
				System.out.println("YES");

				for (int i = 0; i < points; i++) {
					String line = "";
					
					int[] point1 = new int[3];
					point1[permutations[perm[i]][0]] = c[i][0];
					point1[permutations[perm[i]][1]] = c[i][1];
					point1[permutations[perm[i]][2]] = c[i][2];
					
					line = point1[0] + " " + point1[1] + " " + point1[2];
	
					System.out.println(line);
				}

				finito = true;
			}
			
			return;
		}

		for (int l = 0; l < pCount * pCount; l++) {
			if (equal(dist[p1][p2][l], sides[0])) {
				perm[p1] = l / pCount;
				perm[p2] = l % pCount;

				rec(p1 + 2, p2 + 2, dist, sides, perm);
			}

			if (equal(dist[p1][p2][l], sides[1])) {
				perm[p1] = l / pCount;
				perm[p2] = l % pCount;

				rec(p1 + 2, p2 + 2, dist, sides, perm);
			}

			if (equal(dist[p1][p2][l], sides[2])) {
				perm[p1] = l / pCount;
				perm[p2] = l % pCount;

				rec(p1 + 2, p2 + 2, dist, sides, perm);
			}
		}

	}

	static boolean equal(double a, double b) {
		return Math.abs(a - b) < 0.0000001d;
	}

	static double side3(double v) {
		return Math.sqrt(3d) * v;
	}

	static double side2(double v) {
		return Math.sqrt(2d) * v;
	}

	static double dist(int[] p, int[] r) {
		return Math.sqrt(Math.pow(p[0] - r[0], 2) + Math.pow(p[1] - r[1], 2)
				+ Math.pow(p[2] - r[2], 2));
	}
}