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.*;

public class Cube
{
	static int ans[];
	static location[][] aC;
	static double cache[][];
	
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        aC = new location[8][6];
        int x = in.nextInt();
        int y = in.nextInt();
        int z = in.nextInt();
        location coordinate[] = new location[6];
        coordinate[0] = new location(x , y ,z);
        aC[0] = coordinate;
        for(int i = 1; i < 8; i++)
        {
            location coordinates[] = new location[6];
            x = in.nextInt();
            y = in.nextInt();
            z = in.nextInt();
            coordinates[0] = new location(x, y, z);
            coordinates[1] = new location(x, z, y);
            coordinates[2] = new location(y, x, z);
            coordinates[3] = new location(y, z, x);
            coordinates[4] = new location(z, x, y);
            coordinates[5] = new location(z, y, x);
            aC[i] = coordinates;
        }
        ans = new int[8];
        cache = new double[7][6];
        Set<location> loc = new HashSet<location>();
        ans[0] = 0;
        loc.add(aC[0][0]);
        boolean check = solve(loc, 1);
        if(check)
        {
            System.out.println("YES");
            for(int i = 0; i < 8; i ++)
            {
                location t = aC[i][ans[i]];
                System.out.println(t);
            }
        }else
                System.out.println("NO");
    }
    
    public static boolean solve(Set<location> loc, int index)
    {
    	if(index == 8)
    	{
    		return dist();
    	}
    	for(int i = 0; i < 6; i++)
    	{
    		location t = aC[index][i];
    		if(!loc.contains(t))
    		{
    			loc.add(t);
    			ans[index] = i;
    			if(solve(loc, index + 1))
    				return true;
    			else
    				loc.remove(t);
    		}    		
    	}
    	return false;
    }
    
    public static boolean dist()
    {
    	location pivot = aC[0][ans[0]];
    	double distances[] = new double[7];
    	for(int i = 0; i < 7; i++)
    	{
    		if(cache[i][ans[i+1]] == 0)
    		{
	    		location j = aC[i+1][ans[i+1]];
	    		int x = pivot.x - j.x;
	    		int y = pivot.y - j.y;
	    		int z = pivot.z - j.z;
	    		distances[i] = Math.pow(x,2) + Math.pow(y, 2) + Math.pow(z,2);
	    		cache[i][ans[i+1]] = distances[i];
    		}
    		else
    			distances[i] = cache[i][ans[i+1]];
    	}
    	Arrays.sort(distances);
    	if(distances[0] == distances[1] && distances[0] == distances[2] && distances[3] == distances[4] && distances[3] == distances[5] && (distances[0] * 2) == distances[3] && distances[0] * 3 == distances[6])
    		return true;
    	return false;
    }
}

class location
{       
	int x;
    int y;
    int z;
    String loc;

    public location(int a, int b, int c)
    {
        x = a;
        y = b;
        z = c;
        loc = x + " " + y + " " + z;
    }

    public int getX()
    {
        return x;
    }

    public int getY()
    {
        return y;
    }

    public int getZ()
    {
        return z;
    }

    public boolean equals(Object a)
    {
    	return (a instanceof location) && ( x == (((location)a).getX()) && y == (((location)a).getY()) && z == (((location)a).getZ()) );        
    }

    public String toString()
    {
    	return x + " " + y + " " + z;
    }

    public int hashCode()
    {
    	return loc.hashCode();
    }
}