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:
/* Shubhang Verma */
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {

    public static void main(String[] args) 
    {	
        InputStream inputstream = System.in;
        OutputStream outputstream = System.out;
        InputReader in = new InputReader(inputstream);
        OutputWriter out = new OutputWriter(outputstream);
        mysolver mysol = new mysolver();
        mysol.solve(in, out);
        out.close();
    }

}
class node implements Comparable<node>{
	int count;
	long value;
	public int compareTo(node t)
	{
		if(this.value == t.value)
			return 0;
		else if(this.value < t.value)
			return -1;
		else
			return 1;
	}
}
class mysolver {
	public long mod = 1000000007;
    public void solve(InputReader in,OutputWriter out)
    {
    	PrintWriter pout = new PrintWriter(new BufferedOutputStream(System.out));	
    	long A[][] = new long[8][3];
    	for(int i=0;i<8;i++)
    	{
    		for(int j=0;j<3;j++)
    		{
    			A[i][j] = in.readInt();
    		}
    	}
    	int check = recur(A,0);
        if(check == 0)
        {
        	System.out.println("NO");
        }
    	pout.close();
    }
    public int recur(long A[][],int idx)
    {
    	if(idx==8)
    	{
    		// Check validity
    		long size1=Long.MAX_VALUE;
    		for(int i=1;i<8;i++)
    		{
    			long ans = (A[i][0]-A[0][0])*(A[i][0]-A[0][0])+(A[i][1]-A[0][1])*(A[i][1]-A[0][1])+(A[i][2]-A[0][2])*(A[i][2]-A[0][2]);
    			if(ans < size1)
    			{
    				size1 = ans;
    			}
    		}
    		if(size1 == 0)
    		{
    			return 0;
    		}
    		else
    		{
    			int check =0;
    			for(int val = 0;val< 8;val++)
    			{
    				int ss=0;
        			int ss2=0;
        			int ss3=0;
        			//long zero=0;
	    			for(int i=0;i<8;i++)
	    			{
	    				if(i==val)
	    					continue;
	    				long ans = (A[i][0]-A[val][0])*(A[i][0]-A[val][0])+(A[i][1]-A[val][1])*(A[i][1]-A[val][1])+(A[i][2]-A[val][2])*(A[i][2]-A[val][2]);
	        			if(ans == size1)
	        			{
	        				ss++;
	        			}
	        			if(ans == 2*size1)
	        			{
	        				ss2++;
	        			}
	        			if(ans == 3*size1)
	        			{
	        				ss3++;
	        			}
	    			}
	    			
	    			if(ss==3 && ss2==3 && ss3==1)
	    			{
	    				check++;
	    			}
	    			else
	    			{
	    				break;
	    			}
    			}
    			if(check ==8)
    			{
    				System.out.println("YES");
    				for(int i=0;i<8;i++)
    				{
    					for(int j=0;j<3;j++)
    					{
    						System.out.print(A[i][j]+" ");
    					}
    					System.out.println();
    				}
    				return 1;
    			}
    			return 0;
    		}
    	}
    	else
    	{
    		long a = A[idx][0];
    		long b = A[idx][1];
    		long c = A[idx][2];
    		{
    			A[idx][0] = a;
    			A[idx][1] = b;
    			A[idx][2] = c;
    			int val = recur(A,idx+1);
    			if(val == 1)
    				return 1;
    		}
    		{
    			A[idx][0] = a;
    			A[idx][1] = c;
    			A[idx][2] = b;
    			int val = recur(A,idx+1);
    			if(val == 1)
    				return 1;
    		}
    		{
    			A[idx][0] = b;
    			A[idx][1] = a;
    			A[idx][2] = c;
    			int val = recur(A,idx+1);
    			if(val == 1)
    				return 1;
    		}
    		{
    			A[idx][0] = b;
    			A[idx][1] = c;
    			A[idx][2] = a;
    			int val = recur(A,idx+1);
    			if(val == 1)
    				return 1;
    		}
    		{
    			A[idx][0] = c;
    			A[idx][1] = a;
    			A[idx][2] = b;
    			int val = recur(A,idx+1);
    			if(val == 1)
    				return 1;
    		}
    		{
    			A[idx][0] = c;
    			A[idx][1] = b;
    			A[idx][2] = a;
    			int val = recur(A,idx+1);
    			if(val == 1)
    				return 1;
    		}
    	}
    	return 0;
    }
    
     
}
class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;
 
    public InputReader(InputStream stream) {
        this.stream = stream;
    }
    
    public 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++];
    }
 
    public int readInt() {
        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 String readString() {
        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 boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }
 
    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
 
    public String next() {
        return readString();
    }
 
    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}
 
class OutputWriter {
    private final PrintWriter writer;
 
    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
 
    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }
 
    public void close() {
        writer.close();
    }
 
    public void printLine(int i) {
        writer.println(i);
    }
}
 
class IOUtils {
 
    public static void readIntArrays(InputReader in, int[]... arrays) {
        for (int i = 0; i < arrays[0].length; i++) {
            for (int j = 0; j < arrays.length; j++)
                arrays[j][i] = in.readInt();
        }
    }
 
    }