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.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	private void run() throws IOException {
		if (new File("input.txt").exists())
			in = new BufferedReader(new FileReader("input.txt"));
		else
			in = new BufferedReader(new InputStreamReader(System.in));
		if (new File("output.txt").exists())
			out = new PrintWriter("output.txt");
		else
			out = new PrintWriter(System.out);

		solve();

		in.close();
		out.close();
	}

	final long inf = Long.MAX_VALUE / 10;

	final int n = 8;
	final int p = 3;
	long x[][] = new long[n][p];

	long dist[][] = new long[n][n];

	int cnt;
	int y[] = new int[n];

	long sqr(long x) {
		return x * x;
	}

	long getDist(int i, int j) {
		return sqr(x[i][0] - x[j][0]) + sqr(x[i][1] - x[j][1]) + sqr(x[i][2] - x[j][2]);
	}

	int scalarMultiply(long x1, long y1, long z1, long x2, long y2, long z2) {
		BigInteger x = BigInteger.valueOf(x1).multiply(BigInteger.valueOf(x2));
		BigInteger y = BigInteger.valueOf(y1).multiply(BigInteger.valueOf(y2));
		BigInteger z = BigInteger.valueOf(z1).multiply(BigInteger.valueOf(z2));

		return x.add(y).add(z).compareTo(BigInteger.ZERO);
	}

	boolean check() {
		long minDist = inf;
		for (int i = 0; i < n; i++) {
			dist[i][i] = 0;
			for (int j = i + 1; j < n; j++)
				minDist = min(minDist, dist[i][j] = dist[j][i] = getDist(i, j));
		}
		if (minDist == 0)
			return false;

		boolean checkTrue = true;
		for (int i = 0; i < n && checkTrue; i++) {
			cnt = 0;
			for (int j = 0; j < n && checkTrue; j++)
				if (dist[i][j] == minDist) {
					for (int k = 0; k < cnt; k++)
						if (scalarMultiply(x[i][0] - x[j][0], x[i][1] - x[j][1], x[i][2] - x[j][2], x[i][0] - x[y[k]][0], x[i][1] - x[y[k]][1], x[i][2] - x[y[k]][2]) != 0)
							checkTrue = false;
					y[cnt++] = j;
				}
			if (cnt != p)
				checkTrue = false;
		}

		return checkTrue;
	}

	boolean rec(int index, int coordinate) {
		// System.err.println("+");

		if (index == n) {
			// for (int i = 0; i < n; i++) {
			// for (int j = 0; j < p; j++)
			// System.err.print(x[i][j] + " ");
			// }
			// System.err.println();
			return check();
		}

		for (int i = coordinate; i < p; i++) {
			long swap = x[index][coordinate];
			x[index][coordinate] = x[index][i];
			x[index][i] = swap;
			if (rec(index + (coordinate + 1) / p, (coordinate + 1) % p))
				return true;
			swap = x[index][coordinate];
			x[index][coordinate] = x[index][i];
			x[index][i] = swap;
		}

		return false;
	}

	void solve() throws IOException {
		for (int i = 0; i < n; i++)
			for (int j = 0; j < p; j++)
				x[i][j] = nextLong();

		if (rec(0, 0)) {
			out.println("YES");
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < p; j++)
					out.print(x[i][j] + " ");
				out.println();
			}
		} else
			out.println("NO");
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	String nextToken() throws IOException {
		while (!st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String str = in.readLine();
			if (str == null)
				return true;
			st = new StringTokenizer(str);
		}
		return false;
	}

}