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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;


public class Test {

    static StringTokenizer st;
    static int []t = new int[4];
    static BufferedReader buffered;
    static PrintWriter pw;
    static int[][]combos = {{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}};
    static long []xx, yy, zz;
    static int [][]x; 
    static long[]d = new long[8];
    
    public static void main(String[] args) throws IOException {
        buffered = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        x = new int[9][4];
        for (int i = 1; i <= 8; i++) {
            for (int j = 1; j <= 3; j++) {
                x[i][j] = nextInt();
                xx = new long[9];
            }
        }
        xx = new long[9];
        yy = new long[9];
        zz = new long[9];
        main(1);
        System.out.println("NO");
        pw.close();
    }
    private static void main(int ind) {
        if (ind==9) {
            boolean ans = true;
            for (int i = 1; i <= 8; i++) {
                int n = 0;
                for (int j = 1; j <= 8; j++) {
                    if (i==j)
                        continue;
                    d[++n] = dis(xx[i], yy[i], zz[i], xx[j], yy[j], zz[j]);
                }
                Arrays.sort(d, 1, n+1);
                boolean ok = true;
                if (d[1]==0)
                    ok = false;
                if (d[2] != d[1] || d[3] != d[1])
                    ok = false;
                if (d[4] != 2*d[1] || d[5] != 2*d[1] || d[6] != 2*d[1])
                    ok = false;
                if (d[7] != 3*d[1])
                    ok = false;
                if (!ok) {
                    ans = false;
                    break;
                }
            }
            if (ans) {
                System.out.println("YES");
                for (int i = 1; i <= 8; i++) {
                    System.out.println(xx[i]+" "+yy[i]+" "+zz[i]);
                }
                System.exit(0);
            }
            return;
        }
        
        for (int i = 0; i < 6; i++) {
            long xxx = xx[ind];
            long yyy = yy[ind];
            long zzz = zz[ind];
            xx[ind] = x[ind][combos[i][0]];
            yy[ind] = x[ind][combos[i][1]];
            zz[ind] = x[ind][combos[i][2]];
            main(ind+1);
            yy[ind] = yyy;
            zz[ind] = zzz;
            xx[ind] = xxx;
        }
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    
    private static long dis(long x1, long y1, long z1, long x2, long y2, long z2) {
        return (y2-y1)*(y2-y1)+(x2-x1)*(x2-x1)+(z2-z1)*(z2-z1);
    }
    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(buffered.readLine());
        return st.nextToken();
    }
}