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.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.stream.LongStream;

public class Solution{
	
	static int[][] a;
	static PrintWriter out = new PrintWriter(System.out);
	
	
    public static void main(String[] args) throws IOException {
    	
		
    	FastScanner fs = new FastScanner();
//    	PrintWriter out = new PrintWriter(System.out);
    		
    	int tt = 1;
    	while(tt-->0) {
    		
    		a = new int[8][3];
    		
    		for(int i=0;i<8;i++) {
    			for(int j=0;j<3;j++) {
    				a[i][j] = fs.nextInt();
    			}
    		}
    	
    		
    		dfs(1);
    		
    		
    		out.println("NO");
    		
    		
    		
    		
    		
    		
    		
    		
    		
    		
    		
    		
    		
    	
    		
    		
    		
    	}
    	
    	out.close();
    		
    }
    
    
    static void dfs(int k) {
    	if(k==8) {
    		if(check()) {
    			out.println("YES");
    			for(int i=0;i<8;i++) {
    				for(int j=0;j<3;j++) {
    					out.print(a[i][j]+" ");
    				}
    				out.println();
    			}
    			out.flush();
    			System.exit(0);
    		}
    		return;
    	}
    	
    	dfs(k+1);
    	swap(k, 1, 2);
    	dfs(k+1);
    	swap(k, 0, 2);
    	dfs(k+1);
    	swap(k, 1, 2);
    	dfs(k+1);
    	swap(k, 0, 2);
    	dfs(k+1);
    	swap(k, 1, 2);
    	dfs(k+1);
    	
    }
    
    static void swap(int k,int i,int j) {
    	int temp = a[k][j];
    	a[k][j] = a[k][i];
    	a[k][i] = temp; 
    }
    
    
    static boolean check() {
    	HashMap<Long, Integer> map = new HashMap<>();
    	long len = Long.MAX_VALUE;
    	
    	for(int i=0;i<8;i++) {
    		for(int j=i+1;j<8;j++) {
    			long d = dist(i, j);
    			len = Math.min(len, d);
    			map.put(d, map.getOrDefault(d,0)+1);
    		}
    	}
    	
    	if(map.getOrDefault(len , 0)==12 && map.getOrDefault(2*len, 0)==12 && map.getOrDefault(3*len, 0)==4)
			return true;
		return false;
    	
    }
    
    
    
    static long dist(int i, int j) {
    	long dx = (a[i][0]-a[j][0]);
    	dx *= dx;
    	long dy = (a[i][1]-a[j][1]);
    	dy *= dy;
    	long dz = (a[i][2]-a[j][2]);
    	dz *= dz;
    	return dx + dy + dz;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    static final Random random=new Random();
    
    static <T> void shuffle(T[] arr) {
    	int n = arr.length;
    	for(int i=0;i<n;i++	) {
    		int k = random.nextInt(n);
    		T temp = arr[k]; arr[k] = arr[i]; arr[i] = temp;
    	}
    }
    
    	
    static void ruffleSort(int[] a) {
    	int n=a.length;//shuffle, then sort 
    	for (int i=0; i<n; i++) {
    		int oi=random.nextInt(n); int temp=a[oi];
    		a[oi]=a[i]; a[i]=temp;
    	}
    	Arrays.sort(a);
    }
    
    static void ruffleSort(long[] a) {
    	int n=a.length;//shuffle, then sort 
    	for (int i=0; i<n; i++) {
    		int oi=random.nextInt(n); long temp=a[oi];
    		a[oi]=a[i]; a[i]=temp;
    	}
    	Arrays.sort(a);
    }
   
  
    
    static void reverse(int[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++){
    		int temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    
    static void reverse(long[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++){
    		long temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    
    
    static <T> void reverse(T[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++) {
    		T temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    	
    	
    static class FastScanner{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
     
    	public String next(){
    		while(!st.hasMoreElements()){
    			try{
    				st = new StringTokenizer(br.readLine());
    			} catch(IOException e){
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}
    		
    	public String nextLine() throws IOException {
    		return br.readLine();
    	}
    		
    	public int nextInt(){
    		return Integer.parseInt(next());
    	}
     
    	public int[] readArray(int n){
    		int[] a = new int[n];
    		for(int i=0;i<n;i++)
    			a[i] = nextInt();
    		return a;
    	}
    		
    	public long nextLong() {
    		return Long.parseLong(next());
    	}
    		
    	public char nextChar() {
    		return next().toCharArray()[0];
    	}
    }
   	
}