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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
	
	// ArrayList<Integer> lis = new ArrayList<Integer>();
	// ArrayList<String> lis = new ArrayList<String>();
	//  PriorityQueue<P> que = new PriorityQueue<P>();
	// PriorityQueue<Integer> que = new PriorityQueue<Integer>();
	//  Stack<Integer> que = new Stack<Integer>();
    //	static long sum=0;
	// 1000000007 (10^9+7)
	static int mod = 1000000007;
	//static int mod = 1000000009,r=0; ArrayList<Integer> l[]= new ArrayList[n];
   // static int dx[]={1,-1,0,0};
//	static int dy[]={0,0,1,-1};
//	static int dx[]={1,-1,0,0,1,1,-1,-1};
//  static int dy[]={0,0,1,-1,1,-1,1,-1};
	//static Set<Integer> set = new HashSet<Integer>();p
	
public  static void main(String[] args)   throws Exception, IOException{
   //String line=""; throws Exception, IOException
   //(line=br.readLine())!=null
	//Scanner sc =new Scanner(System.in);
	// !!caution!! int long //  
	Reader sc = new Reader(System.in);


 //,a=sc.nextInt(),b=sc.nextInt();
 	// int n=sc.nextInt(),p[]=new int[n],q[]=new int[n];
	//int n=sc.nextInt(),a[]=new int[n],b[]=new int[n];
 

	 int max=1679616/6+1;
	 int e[][]=new int[8][3];
	 
	 for (int i = 0; i < e.length; i++) {
		e[i][0]=sc.nextInt();
		e[i][1]=sc.nextInt();
		e[i][2]=sc.nextInt();
	}
     
	 int d[][]={ {0,1,2},{0,2,1},{1,0,2},{1,2,0},{2,1,0},{2,0,1} };
	 
	 int z[][][]=new int[8][6][3];
	 
	 for(int i=0;i<8;i++)
	 for(int t=0;t<6;t++){

		 z[i][t][0]=e[i][d[t][0]];
		 z[i][t][1]=e[i][d[t][1]];
		 z[i][t][2]=e[i][d[t][2]];
		 
	 }
	 
	 for(int i=0;i<max;i++){
		 double x[][]=new double[8][3];
		 int c=i;
		 for(int t=0;t<8;t++){
			 
			 int k=c%6;c/=6;

			 x[t][0]=z[t][k][0];
			 x[t][1]=z[t][k][1];
			 x[t][2]=z[t][k][2];
			 
		 }
		 
		 if( f(x) ){ System.out.println("YES"); for(int t=0;t<8;t++)System.out.println((int)x[t][0]+" "+(int)x[t][1]+" "+(int)x[t][2]) ;  return;  }
		 
	 }

	  System.out.println("NO");
	  
}

 static boolean f(double d[][]){
	  
	  double ds=Double.MAX_VALUE;
	  
	 // db(d);
	  
	  for(int t=1;t<8;t++){
		  ds=min(ds,dis(d[0],d[t]) );
	  }
	  
	  if( abs(ds)<0.000001 )return false;
	  
	 // db(d,ds);
	  
	  for(int t=0;t<8;t++){ int a[]=new int[10],co=0,c=0; 
		  for(int i=0;i<8;i++){
		  if(t==i)continue;
            if( abs( ds-dis(d[t],d[i]) )<10e-10  ){ c++;
              a[co++]=i;
            }
		  }	
		  
		  if( c!=3 )return false;
		  vect x=new vect(d[t], d[a[0]]);
		  vect y=new vect(d[t], d[a[1]]);
		  vect z=new vect(d[t], d[a[2]]);
		  if( !(abs( x.inmul(y) )<10e-8)  )return false;
		  if( !(abs( x.inmul(z) )<10e-8)  )return false;
		  if( !(abs( y.inmul(z) )<10e-8)  )return false;
		  
	  }
	  
	  
	  
	  
	  return true;
	  
  }

   static double dis(double d[],double dd[]){

	   double a=abs(d[0]-dd[0]);
	   double b=abs(d[1]-dd[1]);
	   double c=abs(d[2]-dd[2]);
	   
	   return  a*a+b*b+c*c;
	   
   }

  static class P implements Comparable<P>{
//	implements Comparable<Pair>
	int id, d; ;
	P(int id,int d){
		this.id=id;
		this.d=d;
	} 
	public int compareTo(P x){
	//	 return  -x.d+d  ; // ascend
		 return   x.d-d  ; //descend
	   }
 
}

static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

}


 class vect{
	// vector point (x,y,z)to(a,b,c) or a[] to b[] 
	 double x,y,z;
	 
	 vect(double x,double y,double z,double a,double b,double c){
		 this.x=a-x;
		 this.y=b-y;		 
		 this.z=c-z;		 
	 }
	 
	 vect(double a[],double b[]){
		 
		 this.x=b[0]-a[0];
		 this.y=b[1]-a[1];	
		 this.z=b[2]-a[2];		 
	 }
	 
	 double inmul(vect X){
		// Main.db(x,y,z,X.x,X.y,X.z);
		 return this.x*X.x+y*X.y+z*X.z;
	 }
	 
 }


class Reader
{ 
	private BufferedReader x;
	private StringTokenizer st;
	
	public Reader(InputStream in)
	{
		x = new BufferedReader(new InputStreamReader(in));
		st = null;
	}
	public String nextString() throws IOException
	{
		while( st==null || !st.hasMoreTokens() )
			st = new StringTokenizer(x.readLine());
		return st.nextToken();
	}
	public int nextInt() throws IOException
	{
		return Integer.parseInt(nextString());
	}
	public long nextLong() throws IOException
	{
		return Long.parseLong(nextString());
	}
	public double nextDouble() throws IOException
	{
		return Double.parseDouble(nextString());
	}
}