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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Hashtable;
import java.util.StringTokenizer;

public class Main {
	public static void main(String args[]) throws NumberFormatException,
			IOException {

		Stdin in = new Stdin();
		PrintWriter out = new PrintWriter(System.out);
		Point[] point = new Point[8];
		int x, y, z;
		int[][] p = new int[8][3];
		for (int i = 0; i < 8; i++) {
			x = in.readInt();
			y = in.readInt();
			z = in.readInt();
			point[i] = new Point(x, y, z);
		}
		for (int i = 0; i < point[0].getSize(); i++) {
			for (int i1 = 0; i1 < point[1].getSize(); i1++) {
				for (int i2 = 0; i2 < point[2].getSize(); i2++) {
					for (int i3 = 0; i3 < point[3].getSize(); i3++) {
						for (int i4 = 0; i4 < point[4].getSize(); i4++) {
							for (int i5 = 0; i5 < point[5].getSize(); i5++) {
								for (int i6 = 0; i6 < point[6].getSize(); i6++) {
									for (int i7 = 0; i7 < point[7].getSize(); i7++) {
										p[0] = point[0].getAPermutations(i);
										p[1] = point[1].getAPermutations(i1);
										p[2] = point[2].getAPermutations(i2);
										p[3] = point[3].getAPermutations(i3);
										p[4] = point[4].getAPermutations(i4);
										p[5] = point[5].getAPermutations(i5);
										p[6] = point[6].getAPermutations(i6);
										p[7] = point[7].getAPermutations(i7);
										if (isCube(p)) {
											out.println("YES");
											for (int j = 0; j < p.length; j++) {
												for (int k = 0; k < p[j].length; k++) {
													if (k > 0)
														out.print(" ");
													out.print(p[j][k]);
												}
												out.println();

											}
											out.flush();
											out.close();
											return;

										}
									}
								}
							}
						}
					}
				}
			}
		}
		out.println("NO");
		out.flush();
		out.close();

	}

	
	public static boolean isCube(int[][] p) {
		Hashtable<Long,Integer>count=new Hashtable<Long,Integer>();
		long dis;
		for(int i=0;i<p.length;i++){
			for(int j=i+1;j<p.length;j++){
				dis=dis(p[i],p[j]);
				if(count.containsKey(dis)){
					count.put(dis, count.get(dis)+1);
				}
				else
					count.put(dis, 1);
				if(count.size()>3)
					return false;
			}
		}
		if(count.size()!=3)
			return false;
		long d=Long.MAX_VALUE;
		for(Long key:count.keySet())
			d=d<key?d:key;
		if(count.get(d)!=12)
			return false;
		if(!count.containsKey(d+d))
			return false;
		else
			if(count.get(d+d)!=12)
				return false;
		if(!count.containsKey(3*d))
			return false;
		else
			if(count.get(3*d)!=4)
				return false;
		return true;

	}
	public static long dis(int[] p1, int[] p2) {
		long dis = 0;
		for (int i = 0; i < p1.length; i++) {
			dis += (long) (p1[i] - p2[i]) * (p1[i] - p2[i]);
		}
		return dis;
	}

	public static class Point {
		private int[][] p;
		private int x, y, z;
		private Point(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
			if (x == y) {
				if (y == z) {
					p = new int[1][3];
					p[0] = new int[] { x, x, x };
				} else {
					p = new int[3][3];
					p[0] = new int[] { z, x, x };
					p[1] = new int[] { x, z, x };
					p[2] = new int[] { x, x, z };
				}
			} else {
				if (x == z) {
					p = new int[3][3];
					p[0] = new int[] { y, x, x };
					p[1] = new int[] { x, y, x };
					p[2] = new int[] { x, x, y };

				} else {
					if (y == z) {
						p = new int[3][3];
						p[0] = new int[] { y, y, x };
						p[1] = new int[] { x, y, y };
						p[2] = new int[] { y, x, y };
					} else {
						p = new int[6][3];
						p[0] = new int[] { x, y, z };
						p[1] = new int[] { x, z, y };
						p[2] = new int[] { y, x, z };
						p[3] = new int[] { y, z, x };
						p[4] = new int[] { z, x, y };
						p[5] = new int[] { z, y, x };
					}
				}
			}
		}

		private int[] getAPermutations(int i) {
			return p[i];
		}

		private int getSize() {
			return p.length;
		}

	}

	private static class Stdin {
		InputStreamReader read;
		BufferedReader br;

		StringTokenizer st = new StringTokenizer("");

		private Stdin() {
			read = new InputStreamReader(System.in);
			br = new BufferedReader(read);

		}

		private String readNext() throws IOException {

			while (!st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		private int readInt() throws IOException, NumberFormatException {

			return Integer.parseInt(readNext());

		}

		private long readLong() throws IOException, NumberFormatException {

			return Long.parseLong(readNext());

		}
	}
}