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.*;
import java.util.*;

public class Main
{
	static  long[][] points; 
	static int counter = 0 ; 
	public static void main( String args[] )
	{
		BufferedReader br = new BufferedReader( new InputStreamReader( System.in), 8*1024);
		Scanner sc = new Scanner( br );
		
		points = new long[8][3];
		
		for( int i = 0 ; i < 8 ; ++i )
			for( int j = 0 ; j < 3 ; ++j )
		points[i][j]  = sc.nextLong();
			
		generate_permutations(1,0);
		
		System.out.println("NO");
		
	}
	
	static void if_yes()
	{
		System.out.println("YES");
		for( int i = 0 ; i < 8 ; ++i )
		{
			
			for( int j = 0 ; j < 3 ; ++j )
				System.out.print( points[i][j] + " ");
			System.out.println();
		}
		
		System.exit(0);
	}
	
	static void test_permutation(  )
	{
		
		
		ArrayList<Long> dist  = new ArrayList<Long>(28); 
		
		for( int i = 0 ; i < 8 ; ++i )
			for( int j = i+1 ; j < 8 ; ++j )
				dist.add( distance( i , j ));

		Collections.sort( dist );
		long  s = dist.get( 0 );
		
		
		for( int i = 0 ; i < 12 ; ++i )
			if( !( s == dist.get(i ) ))
			//if( s != dist.get(i) )
				return ;
		
		for( int i = 12 ; i < 24  ; ++i  )
			if( !(  dist.get(i) == 2*s )  )
			//if( s != 2*dist.get(i) )
				return ; 
		
		for( int i = 24 ; i < 28  ; ++i  )
			if( ! (  dist.get(i)== 3*s )  )
			//if( s != 3*dist.get(i) )
				return ; 
		
			if_yes();
			
	}
	
	static void generate_permutations(int x , int y )
	{
		if( x == 8 ) 
			test_permutation(); 
			
		else if( y == 3 )
		{
			if( st(x + 1))
			generate_permutations( x + 1 , 0 );
		}
			
		else 
		{
			for( int j = y ; j < 3 ; ++j )
				{
				swap( x , y , j  );
				generate_permutations( x , y + 1 );
				swap( x , y , j );
				}
		}			
	}
	
	static boolean st( int x )
	{
	
		ArrayList<Long> dist  = new ArrayList<Long>(28); 
		
		for( int i = 0 ; i < x ; ++i )
			for( int j = i+1 ; j < x ; ++j )
				dist.add( distance( i , j ));

		if( dist.isEmpty() ) return true;
		Collections.sort( dist );
		long  s = dist.get( 0 );
		
		int count1= 0 ,count2 =0 ,count3= 0 ;
		
		int i = 0 ; 
		
			while( i < dist.size() && dist.get(i++) == s )  count1++;
			while( i < dist.size() && dist.get(i++) == 2*s )  count2++;
			while( i < dist.size() && dist.get(i++) == 3*s ) count3++;
			
			if( i <	 dist.size() ) return false;
			if( count1 > 12 ) return false;
			if( count2 > 12 ) return false;
			if( count3 > 4 ) return false;
			
		return true;
	}
	
	static void swap( int  i , int j , int k )
	{
		if( j == k ) return ;
		long temp = points[i][j];
		points[i][j] = points[i][k];
		points[i][k] = temp;
	}
	
	static long distance( int x , int y )
	{
		long temp = 0 ;
		temp += ( points[x][0] -points[y][0] ) * ( points[x][0] -points[y][0] ) ;
		temp += ( points[x][1] -points[y][1] ) * ( points[x][1] -points[y][1] ) ;
		temp += ( points[x][2] -points[y][2] ) * ( points[x][2] -points[y][2] ) ;
		
		return temp;
		
	}
	
}

/*

Sample test(s)
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


*/

/*
-745038 -470013 -245590
168756 -684402 -45561
-75879 -670042 -603554
-168996 -611497 -184954
-609406 -27512 -217363
207089 -195060 33124
-542918 348573 -255696
229392 -187045 -108360


YES
-745038 -470013 -245590
-684402 -45561 168756
-603554 -75879 -670042
-168996 -611497 -184954
-27512 -217363 -609406
33124 207089 -195060
-542918 348573 -255696
-108360 -187045 229392


1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24


*/