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.*;
import java.util.*;

public class B implements Runnable{
	public static void main (String[] args) {new Thread(null, new B(), "_cf", 1 << 28).start();}

	int n = 8;
	int[][] data;
	boolean fnd = false;
	long[][] dist = new long[8][8];

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		data = new int[n][3];
		for(int i = 0; i < n; i++)
			data[i] = fs.nextIntArray(3);
		int[][] g = new int[n][3];
		g[0][0] = data[0][0]; g[0][1] = data[0][1]; g[0][2] = data[0][2];
		go(1, g);
		if(!fnd) System.out.println("NO");

		out.close();
	}

	boolean chk(int[][] perms) {
		long a = Long.MAX_VALUE;
		for(int i = 0; i < n; i++)
			for(int j = i + 1; j < n; j++)
				a = Math.min(a, dist[i][j] = dist[j][i] = dist(perms[i], perms[j]));
		int f1 = 0, f2 = 0, f3 = 0;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) if(j != i) {
				long d = dist[i][j];
				if(d == a) f1++;
				else if(d == a * 2) f2++;
				else if(d == a * 3) f3++;
			}
		}
		return f1 == 24 && f2 == 24 && f3 == 8;
	}

	void go(int at, int[][] perms) {
		if(at == n) {
			if(fnd) return;
			fnd = chk(perms);
			if(fnd) {
				System.out.println("YES");
				for(int i = 0; i < n; i++) {
					System.out.printf("%d %d %d\n", perms[i][0], perms[i][1], perms[i][2]);
				}
			}
			return;
		}
		int[][] loop = new int[8][3];
		loop[0][0] = data[at][0]; loop[0][1] = data[at][1]; loop[0][2] = data[at][2]; //abc
		loop[1][0] = data[at][0]; loop[1][1] = data[at][2]; loop[1][2] = data[at][1]; //acb
		loop[2][0] = data[at][1]; loop[2][1] = data[at][0]; loop[2][2] = data[at][2]; //bac
		loop[3][0] = data[at][1]; loop[3][1] = data[at][2]; loop[3][2] = data[at][0]; //bca
		loop[4][0] = data[at][2]; loop[4][1] = data[at][0]; loop[4][2] = data[at][1]; //cab
		loop[5][0] = data[at][2]; loop[5][1] = data[at][1]; loop[5][2] = data[at][0]; //cba

		for(int i = 0; i < 6 && !fnd; i++) {
			perms[at] = loop[i];
			go(at+1, perms);
		}
	}

	long dist(int[] a, int[] b) {
		long X = a[0] - b[0];
		long Y = a[1] - b[1];
		long Z = a[2] - b[2];
		return X*X + Y*Y + Z*Z;
	}


	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}

	}

}