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 D2
{
    public static void main(String av[]) {
        Scanner s = new Scanner();
        int [][] p = new int[8][];
        for (int i = 0 ; i < 8; i++) {
            p[i] = new int[] { s.nextInt(), s.nextInt(), s.nextInt() };
        }
        tryall(p, 0, new HashSet<Long>(), new int[8][]);
        System.out.println("NO");
    }

    static long dist2(int []a, int []b) {
        long dx = a[0] - b[0];
        long dy = a[1] - b[1];
        long dz = a[2] - b[2];
        return dx * dx + dy * dy + dz * dz;
    }

    static boolean cube(int [][]c) {
        for (int i = 0; i < 8; i++) {
            long [] d2 = new long[7];
            for (int k = 0, j = 0; j < 8; j++) if (i != j) {
                d2[k] = dist2(c[i], c[j]);
                k++;
            }
            Arrays.sort(d2);
            // a^2 a^2 a^2 2a^2 2a^2 2a^2 3a^3
            if (d2[0] != d2[1] || d2[1] != d2[2] 
              || d2[3] != d2[4] || d2[4] != d2[5]
              || 2 * d2[0] != d2[3]
              || 3 * d2[0] != d2[6]
            )
                return false;
        }
        return true;
    }

    static long encode(int []c) {
        return 2000000000000L * (long)c[0] + 2000000L * (long)c[1] + (long)c[2];
    }

    static void tryall(int [][]p, int i, Set<Long> used, int [][]c) {
        if (i == 8) {

/*
            System.out.println("checking ");
            for (int k =0 ; k < 8; k++)
                System.out.print(" " + c[k][0] + " " + c[k][1] + " " + c[k][2]);
            System.out.println();
*/


            boolean isCube = cube(c);
            if (isCube) {
                System.out.println("YES");
                for (int [] _c : c)
                    System.out.printf("%d %d %d%n", _c[0], _c[1], _c[2]);
                System.exit(0);
            }
            return;
        }

        int [][] a = new int[][] {
                new int[] { p[i][0], p[i][1], p[i][2] },
                new int[] { p[i][0], p[i][2], p[i][1] },
                new int[] { p[i][1], p[i][0], p[i][2] },
                new int[] { p[i][1], p[i][2], p[i][0] },
                new int[] { p[i][2], p[i][0], p[i][1] },
                new int[] { p[i][2], p[i][1], p[i][0] }
        };

        for (int [] a0 : a) {
            long n0 = encode(a0);
            if (!used.contains(n0)) {
                c[i] = a0;
                used.add(n0);
                tryall(p, i+1, used, c);
                used.remove(n0);
            }
        }
    }

    //-----------Scanner class for faster input----------
    /* Provides similar API as java.util.Scanner but does not
     * use regular expression engine.  
     */
    public static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        public Scanner(Reader in) {
            br = new BufferedReader(in);
        }

        public Scanner() { this(new InputStreamReader(System.in)); }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }

        // Slightly different from java.util.Scanner.nextLine(),
        // which returns any remaining characters in current line,
        // if any.  
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    //--------------------------------------------------------    
}