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:
//package com.company;

import java.io.*;
import java.util.*;

public class Main {
    static long TIME_START, TIME_END;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("Test.in"));
        PrintWriter pw = new PrintWriter(System.out);
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.in"));

        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
//        System.out.println("Memory increased:" + (usedMemoryAfter-usedMemoryBefore) / 1000000 );
//        System.out.println("Time used: " + (TIME_END - TIME_START) + ".");


    }

    public static class Task {

        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            int[][] points = new int[8][3];
            for (int i = 0; i < 8; i++) {
                for (int j = 0; j < 3; j++) {
                    points[i][j] = sc.nextInt();
                }
            }
            int[] state = new int[8];
            int[][] actualPoints = new int[8][3];
            int[][] state_to = new int[6][];
            state_to[0] = new int[]{0, 1, 2};
            state_to[1] = new int[]{0, 2, 1};
            state_to[2] = new int[]{1, 0, 2};
            state_to[3] = new int[]{1, 2, 0};
            state_to[4] = new int[]{2, 0, 1};
            state_to[5] = new int[]{2, 1, 0};
            for (int i = 0; i < 3; i++) {
                actualPoints[0][i] = points[0][i];
            }
            for (state[1] = 0; state[1] < 6; state[1]++) {
                permute(points[1], state_to[state[1]],actualPoints[1]);
                for (state[2] = 0; state[2] < 6; state[2]++) {
                    permute(points[2], state_to[state[2]],actualPoints[2]);
                    for (state[3] = 0; state[3] < 6; state[3]++) {
                        permute(points[3], state_to[state[3]],actualPoints[3]);
                        for (state[4] = 0; state[4] < 6; state[4]++) {
                            permute(points[4], state_to[state[4]],actualPoints[4]);
                            for (state[5] = 0; state[5] < 6; state[5]++) {
                                permute(points[5], state_to[state[5]],actualPoints[5]);
                                for (state[6] = 0; state[6] < 6; state[6]++) {
                                    permute(points[6], state_to[state[6]],actualPoints[6]);
                                    for (state[7] = 0; state[7] < 6; state[7]++) {
                                        permute(points[7], state_to[state[7]],actualPoints[7]);
                                        if (check(actualPoints)) {
                                            pw.println("YES");
                                            for (int i = 0; i < 8; i++) {
                                                for (int j = 0; j < 3; j++) {
                                                    pw.print(actualPoints[i][j] + " ");
                                                }
                                                pw.println();
                                            }
                                            return;
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
            pw.println("NO");
        }

        public void permute(int[] original, int[] perm, int[] fill) {
            for (int i = 0; i < 3; i++) {
                fill[i] = original[perm[i]];
            }
        }

        public boolean check(int[][] points){
            long[] a = new long[3];
            Arrays.fill(a, -1L);
            int[] c=  new int[3];
            for (int i = 0; i < 8; i++) {
                for (int j = i + 1; j < 8; j++) {
                    long d = dis3(points[i], points[j]);
                    boolean find = false;
                    for (int k = 0; k < 3; k++) {
                        if (a[k] == d) {
                            c[k]++;
                            find = true;
                            break;
                        } else if (a[k] == -1) {
                            a[k] = d;
                            c[k]= 1;
                            find = true;
                            break;
                        }
                    }
                    if (!find) return false;
                }
            }
            return ccc(a, c);
        }

        public boolean ccc(long[] a, int[] c){
            Integer[] perm = new Integer[3];
            for (int i = 0; i < 3; i++) {
                perm[i] = i;
            }
            Arrays.sort(perm, new Comparator<Integer>() {
                @Override
                public int compare(Integer integer, Integer t1) {
                    return Long.compare(a[integer], a[t1]);
                }
            });
            if (a[perm[0]] * 2 != a[perm[1]] || a[perm[0]] * 3 != a[perm[2]]) {
                return false;
            }
            if (c[perm[0]] != 12 || c[perm[1]] != 12 || c[perm[2]] != 4){
                return false;
            }
            return true;
        }

        public long dis3(int[] a, int[]b){
            long res = 0;
            for (int i = 0; i < 3; i++) {
                res += (long) (a[i] - b[i]) *(a[i] - b[i]);
            }
            return res;
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public Scanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(s);}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {return br.readLine();}

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

        public boolean ready() throws IOException {return br.ready();}
    }
}