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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, FastScanner in, PrintWriter out) {
		this.out = out;
		coords = new int[8][3];
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 3; j++) {
				coords[i][j] = in.nextInt();
			}
			Arrays.sort(coords[i]);
		}
		rec(0, 0);
		if (!answerPrinted) {
			out.println("NO");
		}
    }

	int[][] coords;
	int[][] firstFour = new int[4][];
	boolean answerPrinted = false;
	PrintWriter out;
	int[][] ans = new int[8][];

	private void rec(int pos, int usedMask) {
		if (answerPrinted) {
			return;
		}
		if (pos == 4) {
			boolean[] dead = new boolean[8];
			for (int i = 0; i < 8; i++) {
				if ((usedMask & (1 << i)) > 0) {
					dead[i] = true;
				}
			}
			int[] o = firstFour[0];
			int[] x = firstFour[1];
			int[] y = firstFour[2];
			int[] z = firstFour[3];
			int[] xy = add(o, add(sub(x, o), sub(y, o)));
			int[] xz = add(o, add(sub(x, o), sub(z, o)));
			int[] yz = add(o, add(sub(y, o), sub(z, o)));
			int[] xyz = add(o, add(sub(xy, o), sub(z, o)));
			if (!mark(dead, xy)) return;
			if (!mark(dead, xz)) return;
			if (!mark(dead, yz)) return;
			if (!mark(dead, xyz)) return;
			if (lengthSquared(sub(x, o)) == 0) return;
			if (lengthSquared(sub(x, o)) != lengthSquared(sub(y, o))) return;
			if (lengthSquared(sub(x, o)) != lengthSquared(sub(z, o))) return;
			int[] ox = sub(x, o);
			int[] oy = sub(y, o);
			int[] oz = sub(z, o);
			long[] oxl = new long[]{ox[0], ox[1], ox[2]};
			long[] oyl = new long[]{oy[0], oy[1], oy[2]};
			long[] ozl = new long[]{oz[0], oz[1], oz[2]};
			long[] zero = new long[3];
			long[] cr1 = cross(cross(oxl, oyl), ozl);
			if (!Arrays.equals(cr1, zero)) return;
			long[] cr2 = cross(cross(oyl, ozl), oxl);
			if (!Arrays.equals(cr2, zero)) return;
			long[] cr3 = cross(cross(ozl, oxl), oyl);
			if (!Arrays.equals(cr3, zero)) return;
			answerPrinted = true;
			out.println("YES");
			Arrays.fill(dead, false);
			setAns(dead, o);
			setAns(dead, x);
			setAns(dead, y);
			setAns(dead, z);
			setAns(dead, xy);
			setAns(dead, xz);
			setAns(dead, yz);
			setAns(dead, xyz);
			for (int i = 0; i < 8; i++) {
				printPoint(ans[i]);
			}
			return;
		}
		for (int i = 0; i < 8; i++) {
			if ((usedMask & (1 << i)) == 0) {
				for (int[] p : genPermutations(coords[i])) {
					firstFour[pos] = p;
					rec(pos + 1, usedMask | (1 << i));
				}
			}
		}
	}

	private long[] cross(long[] a, long[] b) {
		return new long[]{
			a[1]*b[2] - a[2]*b[1],
			a[2]*b[0] - a[0]*b[2],
			a[0]*b[1] - a[1]*b[0],
		};
	}

	private long lengthSquared(int[] a) {
		long x = a[0];
		long y = a[1];
		long z = a[2];
		return x*x + y*y + z*z;
	}

	private void printPoint(int[] a) {
		out.println(a[0] + " " + a[1] + " " + a[2]);
	}

	private boolean mark(boolean[] dead, int[] p) {
		int[] sorted = p.clone();
		Arrays.sort(sorted);
		for (int i = 0; i < dead.length; i++) {
			if (!dead[i] && Arrays.equals(sorted, coords[i])) {
				dead[i] = true;
				return true;
			}
		}
		return false;
	}

	private void setAns(boolean[] dead, int[] a) {
		int[] sorted = a.clone();
		Arrays.sort(sorted);
		for (int i = 0; i < 8; i++) {
			if (!dead[i] && Arrays.equals(sorted, coords[i])) {
				ans[i] = a.clone();
				dead[i] = true;
				return;
			}
		}
	}

	private int[] add(int[] a, int[] b) {
		return new int[]{a[0] + b[0], a[1] + b[1], a[2] + b[2]};
	}

	private int[] sub(int[] a, int[] b) {
		return new int[]{a[0] - b[0], a[1] - b[1], a[2] - b[2]};
	}

	private int[][] genPermutations(int[] a) {
		return new int[][]{
			new int[]{a[0], a[1], a[2]},
			new int[]{a[0], a[2], a[1]},
			new int[]{a[1], a[0], a[2]},
			new int[]{a[1], a[2], a[0]},
			new int[]{a[2], a[0], a[1]},
			new int[]{a[2], a[1], a[0]},
		};
	}

}

class FastScanner {

	private BufferedReader in;
	private StringTokenizer st;

	public FastScanner(InputStream stream) {
		in = new BufferedReader(new InputStreamReader(stream));
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(in.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

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

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

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

}