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.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.PriorityQueue;

public class B464 {
	static class Solver {

		int N = 8;
		int[][] p3 = { { 0, 1, 2 }, { 0, 2, 1 }, { 1, 0, 2 }, { 1, 2, 0 }, { 2, 0, 1 }, { 2, 1, 0 } };
		long[][] pts[] = new long[6][8][3], dist[][] = new long[6][8][6][8];
		long[] d = new long[28];
		PriorityQueue<Long> q = new PriorityQueue<>();

		boolean works(int m) {
			int m2 = m;
			int[] a = new int[8];
			for (int i = 0; i < 8; i++) {
				a[i] = m2 % 6;
				m2 /= 6;
			}
			long l = (long) 1e18;
			for (int i = 0, p = 0; i < 8; i++)
				for (int j = i + 1; j < 8; j++, p++) {
					d[p] = dist[a[i]][i][a[j]][j];
					l = l < d[p] ? l : d[p];
				}
			a[0] = a[1] = a[2] = 0;
			for (long c : d) {
				if (c == l)
					a[0]++;
				else if (c == 2 * l)
					a[1]++;
				if (c == 3 * l)
					a[2]++;
			}
			return a[0] == 12 && a[1] == 12 && a[2] == 4;
		}

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

		void print(int m, PrintWriter out) {
			for (int i = 0; i < 8; i++) {
				int k = m % 6;
				out.printf("%d %d %d%n", pts[k][i][0], pts[k][i][1], pts[k][i][2]);
				m /= 6;
			}
		}

		void solve(FastScanner s, PrintWriter out) {
			pts[0] = s.next2DLongArray(8, 3);
			for (int i = 1; i < 6; i++)
				for (int c = 0; c < 8; c++)
					for (int j = 0; j < 3; j++)
						pts[i][c][j] = pts[0][c][p3[i][j]];

			for (int p1 = 0; p1 < 6; p1++)
				for (int a = 0; a < 8; a++)
					for (int p2 = 0; p2 < 6; p2++)
						for (int b = 0; b < 8; b++)
							dist[p1][a][p2][b] = dist(pts[p1][a], pts[p2][b]);

			int cur = 0, max = 6 * 6 * 6 * 6 * 6 * 6 * 6 * 6;
			while (cur < max) {
				if (works(cur)) {
					out.println("YES");
					print(cur, out);
					return;
				}
				cur++;
			}
			out.println("NO");

		}

	}

	public static void main(String[] args) {

		FastScanner s = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Solver solver = new Solver();
		solver.solve(s, out);

		out.close();

	}

	static int swap(int a, int b) {
		return a;
	}

	static Object swap(Object a, Object b) {
		return a;
	}

	static String ts(Object... o) {
		return Arrays.deepToString(o);
	}

	double min(double a, double b) {
		return a < b ? a : b;
	}

	static class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
		}

		public FastScanner(File f) throws FileNotFoundException {
			this(new FileInputStream(f));
		}

		public FastScanner(String s) {
			this.stream = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}

		// Jacob Garbage

		public int[] nextIntArray(int N) {
			int[] ret = new int[N];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextInt();
			return ret;
		}

		public int[][] next2DIntArray(int N, int M) {
			int[][] ret = new int[N][];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextIntArray(M);
			return ret;
		}

		public long[] nextLongArray(int N) {
			long[] ret = new long[N];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextLong();
			return ret;
		}

		public long[][] next2DLongArray(int N, int M) {
			long[][] ret = new long[N][];
			for (int i = 0; i < N; i++)
				ret[i] = nextLongArray(M);
			return ret;
		}

		public double[] nextDoubleArray(int N) {
			double[] ret = new double[N];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextDouble();
			return ret;
		}

		public double[][] next2DDoubleArray(int N, int M) {
			double[][] ret = new double[N][];
			for (int i = 0; i < N; i++)
				ret[i] = this.nextDoubleArray(M);
			return ret;
		}

	}
}