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.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;


public class B {

    class Point{
        long x,y,z;

        Point(long x, long y, long z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        long dist(Point p){
            return (x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)+(z-p.z)*(z-p.z);
        }
        Point shift(Point p){
            return new Point(x+p.x,y+p.x,z+p.z);
        }
        Point reverse(){
            return new Point(-x,-y,-z);
        }

        boolean equals(Point p){
            return x==p.x&&y==p.y&&z==p.z;
        }
    }

    boolean isOrtogonal(Point a,Point b,Point c){
        long x1=b.x-a.x;
        long y1=b.y-a.y;
        long z1=b.z-a.z;
        long x2=c.x-b.x;
        long y2=c.y-b.y;
        long z2=c.z-b.z;
        //Point p1=b.shift(a.reverse());
        //Point p2=c.shift(b.reverse());
        //return p1.x*p2.x+p1.y*p2.y+p1.z*p2.z==0;
        return x1*x2+y1*y2+z1*z2==0;
    }

    boolean check(Point[] points){
        long minDist=(long)10e18;
        int ind=-1;
        for(int i=1;i<8;i++){
            long cd=points[0].dist(points[i]);
            if(cd<minDist){
                minDist=cd;
                ind=i;
            }
        }
        if(minDist==0)
            return false;
        HashSet<Integer> first=new HashSet<Integer>();
        ArrayList<Integer> firstArr=new ArrayList<Integer>();
        first.add(0);
        first.add(ind);
        firstArr.add(0);
        firstArr.add(ind);
        for(int i=0;i<8;i++)
            if(!first.contains(i)&&points[ind].dist(points[i])==minDist){
                ind=i;
                first.add(i);
                firstArr.add(ind);
                break;
            }
        if(first.size()==2)
            return false;
        for(int i=0;i<8;i++)
            if(!first.contains(i)&&points[ind].dist(points[i])==minDist&&points[i].dist(points[firstArr.get(0)])==minDist){
                first.add(i);
                firstArr.add(i);
                break;
            }
        if(first.size()==3)
            return false;
        for(int i=0;i<4;i++){
            if(!isOrtogonal(points[firstArr.get(i)],points[firstArr.get((i+1)%4)],points[firstArr.get((i+2)%4)]))
                return false;
        }

        ind=-1;
        HashSet<Integer> second=new HashSet<Integer>();
        ArrayList<Integer> secondArr=new ArrayList<Integer>();

        for(int i=0;i<8;i++)
            if(!first.contains(i)&&points[i].dist(points[firstArr.get(0)])==minDist){
                ind=i;
                break;
            }
        if(ind==-1)
            return false;

        second.add(ind);
        secondArr.add(ind);

        for(int j=0;j<3;j++){
            int prev=ind;
            ind=-1;
            for(int i=0;i<8;i++)
                if(!first.contains(i)&&!second.contains(i)&&points[prev].dist(points[i])==minDist&&points[firstArr.get(j+1)].dist(points[i])==minDist){
                    ind=i;
                    break;
                }
            if(ind==-1)
                return false;
            second.add(ind);
            secondArr.add(ind);
        }

        if(points[secondArr.get(0)].dist(points[secondArr.get(3)])!=minDist)
            return false;

        for(int i=0;i<4;i++){
            if(!isOrtogonal(points[secondArr.get(i)],points[secondArr.get((i+1)%4)],points[secondArr.get((i+2)%4)]))
                return false;
        }

        if(!isOrtogonal(points[firstArr.get(0)],points[secondArr.get(0)],points[secondArr.get(2)]))
            return false;

        return true;
    }

    void solve() throws IOException {
        int[][] a=new int[8][3];
        for(int i=0;i<8;i++)
            for(int j=0;j<3;j++)
                a[i][j]=nextInt();
        int[][] p={{0,1,2},{0,2,1},{1,0,2},{1,2,0},{2,0,1},{2,1,0}};
        int border=1;
        for(int i=0;i<8;i++)border*=6;
//        System.err.println(border);
        border/=2;
        for(int i=0;i<border;i++){
            Point[] points=new Point[8];
            int cur=i;
            boolean good=true;
            for(int j=0;j<8;j++){
                int x=cur%6;
                cur/=6;
                points[j]=new Point(a[j][p[x][0]],a[j][p[x][1]],a[j][p[x][2]]);
                for(int k=0;k<j;k++)
                    if(points[k].equals(points[j])){
                        good=false;
                        break;
                    }
            }
            if(good)
            if(check(points)){
                out.println("YES");
                for(int k=0;k<8;k++)
                    out.println(points[k].x+" "+points[k].y+" "+points[k].z);
                return;
            }
        }
        out.println("NO");
    }

    public static void main(String[] args) throws IOException {
        new B().run();
    }

    void run() throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
//      reader = new BufferedReader(new FileReader("input.txt"));
        tokenizer = null;
        out = new PrintWriter(new OutputStreamWriter(System.out));
//      out = new PrintWriter(new FileWriter("output.txt"));
        solve();
        reader.close();
        out.flush();

    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}