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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;

public class Main {

	public static void main(String[] args) {
		// TaskA mSol = new TaskA();
		// TaskB mSol = new TaskB();
		// TaskC mSol = new TaskC();
		TaskD mSol = new TaskD();
		// TaskE mSol = new TaskE();
		mSol.solve();
		mSol.flush();
		mSol.close();
	}

}

class TaskD {

	public FasterScanner mFScanner;
	public PrintWriter mOut;
	public int mCoords[][];
	public int mAnsCoord[][];
	public int mPerms[][];
	public int N;
	public static final double sSqrtTwo = Math.sqrt(2);
	public static final double sSqrtThree = Math.sqrt(3);
	public static final double sError = 0.000001;
	public ArrayList<Double> mNum;

	public TaskD() {
		mFScanner = new FasterScanner();
		mOut = new PrintWriter(System.out);
	}

	public void solve() {
		mAnsCoord = new int[8][3];
		mCoords = new int[8][3];
		mPerms = new int[8][3];
		N = 8;

		double time = System.currentTimeMillis();
		mNum = new ArrayList<>();

		for (int i = 0; i < 8; i++) {
			mCoords[i][0] = mFScanner.nextInt();
			mCoords[i][1] = mFScanner.nextInt();
			mCoords[i][2] = mFScanner.nextInt();
			mPerms[i][0] = 0;
			mPerms[i][1] = 1;
			mPerms[i][2] = 2;
		}

		boolean status;

		status = solve(0);

		double finalTime = System.currentTimeMillis();

		if (status) {
			mOut.println("YES");
			for (int i = 0; i < N; i++) {
				mOut.print(mAnsCoord[i][0]);
				mOut.print(" ");
				mOut.print(mAnsCoord[i][1]);
				mOut.print(" ");
				mOut.println(mAnsCoord[i][2]);
			}
		} else {
			mOut.println("NO");
		}

		// mOut.println("Time required in ms: " + (finalTime - time));
	}

	public boolean solve(int index) {

		if (index == 8) {
			return check();
		}

		boolean status;

		if (index == 0) {
			mAnsCoord[index][0] = mCoords[index][0];
			mAnsCoord[index][1] = mCoords[index][1];
			mAnsCoord[index][2] = mCoords[index][2];
			status = solve(index + 1);
			return status;
		} else {
			do {
				mAnsCoord[index][0] = mCoords[index][mPerms[index][0]];
				mAnsCoord[index][1] = mCoords[index][mPerms[index][1]];
				mAnsCoord[index][2] = mCoords[index][mPerms[index][2]];

				status = solve(index + 1);

				if (status)
					return true;

			} while (nextPerm(mPerms[index]));
		}

		mPerms[index][0] = 0;
		mPerms[index][1] = 1;
		mPerms[index][2] = 2;

		return false;
	}

	public boolean check() {

		double x, y, z;
		double dist;
		double side;
		double diag;
		double longDiag;
		mNum.clear();

		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				x = Math.abs(mAnsCoord[i][0] - mAnsCoord[j][0]);
				y = Math.abs(mAnsCoord[i][1] - mAnsCoord[j][1]);
				z = Math.abs(mAnsCoord[i][2] - mAnsCoord[j][2]);
				dist = Math.sqrt(x * x + y * y + z * z);
				mNum.add(dist);
			}
		}

		Collections.sort(mNum);

		side = mNum.get(0);
		
		if (side <= sError)
			return false;

		for (int i = 1; i < 12; i++) {
			dist = mNum.get(i);

			// if (dist <= side + sError && dist >= side - sError)
			if (Math.abs(dist - side) <= sError)
				continue;
			else
				return false;
		}

		diag = side * sSqrtTwo;

		for (int i = 12; i < 24; i++) {
			dist = mNum.get(i);

			// if (dist <= diag + sError && dist >= diag - sError)
			if (Math.abs(dist - diag) <= sError)
				continue;
			else
				return false;
		}

		longDiag = side * sSqrtThree;

		for (int i = 24; i < 28; i++) {
			dist = mNum.get(i);

			// if (dist <= longDiag + sError && dist >= longDiag - sError)
			if (Math.abs(dist - longDiag) <= sError)
				continue;
			else
				return false;
		}

		return true;
	}

	public boolean nextPerm(int[] a) {

		int i;
		int j;
		int N;
		int temp;

		N = a.length;
		i = N - 2;

		for (; i >= 0; i--) {
			if (a[i] < a[i + 1])
				break;
		}
		if (i < 0)
			return false;

		for (j = N - 1; j >= i; j--) {
			if (a[j] > a[i]) {
				temp = a[j];
				a[j] = a[i];
				a[i] = temp;
				break;
			}
		}

		for (j = i + 1; j < (N + i + 1) / 2; j++) {
			temp = a[N - j + i];
			a[N - j + i] = a[j];
			a[j] = temp;
		}

		return true;
	}

	public void flush() {
		mOut.flush();
	}

	public void close() {
		mOut.close();
	}
}

class FasterScanner {
	private InputStream mIs;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	public FasterScanner() {
		this(System.in);
	}

	public FasterScanner(InputStream is) {
		mIs = is;
	}

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

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

	public String nextString() {
		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 long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

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

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

}