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

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * 4 4
 * 1 5 3 4
 * 1 2
 * 1 3
 * 2 3
 * 3 3
 *
 *
 * @author pttrung
 */
public class A {

    public static long Mod = (long) (1e9);
    public static int[][][] dp;

    public static void main(String[] args) throws FileNotFoundException {

        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        P3[] data = new P3[8];
        for (int i = 0; i < 8; i++) {
            data[i] = new P3(in.nextInt(), in.nextInt(), in.nextInt());
        }
        int[][] per = new int[8][3];
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 3; j++) {
                per[i][j] = j;
            }
           // System.out.println(Arrays.toString(per[i]));
        }
        int count = 0;
        do {
            per[1] =new int[] {0,1,2};
            do {
                per[2] =new int[] {0,1,2};
                do {
                    per[3] =new int[] {0,1,2};
                    do {
                        per[4] =new int[] {0,1,2};
                        do {
                            per[5] =new int[] {0,1,2};
                            do {
                                per[6] =new int[] {0,1,2};
                                do {
                                    per[7] =new int[] {0,1,2};
                                    do {
                                        long d = -1;
                                        boolean ok = true;
                                        for (int i = 0; i < 8; i++) {
                                            long[] dist = new long[8];
                                            long min = Long.MAX_VALUE;
                                            for (int j = 0; j < 8; j++) {
                                                if (i != j) {
                                                    dist[j] = dist2(data[i].p[per[i][0]], data[i].p[per[i][1]], data[i].p[per[i][2]], data[j].p[per[j][0]], data[j].p[per[j][1]], data[j].p[per[j][2]]);
                                                    min = min > dist[j] ? dist[j] : min;
                                                }
                                            }
                                            if (min == 0) {
                                                count++;
                                               // System.out.println(min);
                                                ok = false;
                                                break;
                                            } else {
                                                if (d == -1) {
                                                    d = min;
                                                } else if (d != min) {
                                                    count++;
                                                   // System.out.println(min);
                                                    ok = false;
                                                    break;
                                                }
                                            }
                                            ArrayList<P3> list = new ArrayList();
                                            for (int j = 0; j < 8 && ok; j++) {
                                                if (dist[j] == d) {
                                                    list.add(new P3(data[j].p[per[j][0]], data[j].p[per[j][1]], data[j].p[per[j][2]]));
                                                }
                                            }
                                            //System.out.println(list.size() + " " + d); 
                                            if (list.size() == 3) {
                                                for (int j = 0; j < 3; j++) {
                                                    int nxt = (j + 1) % 3;
                                                    long x1 = data[i].p[per[i][0]] - list.get(j).p[0];
                                                    long y1 = data[i].p[per[i][1]] - list.get(j).p[1];
                                                    long z1 = data[i].p[per[i][2]] - list.get(j).p[2];
                                                    long x2 = data[i].p[per[i][0]] - list.get(nxt).p[0];
                                                    long y2 = data[i].p[per[i][1]] - list.get(nxt).p[1];
                                                    long z2 = data[i].p[per[i][2]] - list.get(nxt).p[2];
                                                    if (x1 * x2 + y1 * y2 + z1 * z2 != 0) {
                                                        count++;
                                                      //  System.out.println(data[i].p[per[i][0]] + " " + data[i].p[per[i][1]] + " "  + data[i].p[per[i][2]] + " " + list.get(j) + " " +  list.get(nxt));
                                                        ok = false;
                                                        break;
                                                    }
                                                }


                                            } else {
                                               // System.out.println("Not 3");
                                                count++;
                                                ok = false;
                                                break;
                                            }
                                        }
                                        if (ok) {
                                            out.println("YES");
                                            for (int j = 0; j < 8; j++) {
                                                for (int k = 0; k < 3; k++) {
                                                    out.print(data[j].p[per[j][k]] + " ");
                                                }
                                                out.println();
                                            }
                                            out.close();
                                            System.exit(0);
                                        }





                                    } while (nextPer(per[7]));
                                } while (nextPer(per[6]));
                            } while (nextPer(per[5]));
                        } while (nextPer(per[4]));
                    } while (nextPer(per[3]));
                } while (nextPer(per[2]));
            } while (nextPer(per[1]));
            
        } while (nextPer(per[0]));
        out.println("NO");
        //System.out.println(Arrays.toString(per[7]));
        out.close();
    }

    static class P3 {

        long[] p = new long[3];

        P3(int x, int y, int z) {
            p[0] = x;
            p[1] = y;
            p[2] = z;
        }

        P3(long x, long y, long z) {
            p[0] = x;
            p[1] = y;
            p[2] = z;
        }

        @Override
        public String toString() {
            return "P3{" + "p=" + Arrays.toString(p) + '}';
        }
    }

    static long dist2(long x1, long y1, long z1, long x2, long y2, long z2) {
        long x = x1 - x2;
        long y = y1 - y2;
        long z = z1 - z2;
        return x * x + y * y + z * z;
    }

    static int find(int index, int[] u) {
        if (index != u[index]) {
            return u[index] = find(u[index], u);
        }
        return index;
    }

    public static long pow(int a, int b, long mod) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long v = pow(a, b / 2, mod);
        if (b % 2 == 0) {
            return (v * v) % mod;
        } else {
            return (((v * v) % mod) * a) % mod;
        }
    }

    public static int[][] powSquareMatrix(int[][] A, long p) {
        int[][] unit = new int[A.length][A.length];
        for (int i = 0; i < unit.length; i++) {
            unit[i][i] = 1;
        }
        if (p == 0) {
            return unit;
        }
        int[][] val = powSquareMatrix(A, p / 2);
        if (p % 2 == 0) {
            return mulMatrix(val, val);
        } else {
            return mulMatrix(A, mulMatrix(val, val));
        }

    }

    public static int[][] mulMatrix(int[][] A, int[][] B) {
        int[][] result = new int[A.length][B[0].length];
        for (int i = 0; i < result.length; i++) {
            for (int j = 0; j < result[0].length; j++) {
                long temp = 0;
                for (int k = 0; k < A[0].length; k++) {

                    temp += ((long) A[i][k] * B[k][j] % Mod);
                    temp %= Mod;
                }
                temp %= Mod;
                result[i][j] = (int) temp;
            }
        }

        return result;
    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;




    }

    static class FT {

        int[] data;

        FT(int n) {
            data = new int[n];
        }

        void update(int index, int val) {
            // System.out.println("UPDATE INDEX " + index);
            while (index < data.length) {
                data[index] += val;
                index += index & (-index);

                //    System.out.println("NEXT " +index);
            }
        }

        int get(int index) {
            //  System.out.println("GET INDEX " + index);
            int result = 0;
            while (index > 0) {
                result += data[index];
                index -= index & (-index);
                // System.out.println("BACK " + index);
            }
            return result;
        }
    }

    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    static long pow(long a, int b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2);
        if (b % 2 == 0) {

            return val * val % Mod;
        } else {
            return (val * val % Mod) * a % Mod;
        }
    }

//    static Point intersect(Point a, Point b, Point c) {
//        double D = cross(a, b);
//        if (D != 0) {
//            return new Point(cross(c, b) / D, cross(a, c) / D);
//        }
//        return null;
//    }
//
//    static Point convert(Point a, double angle) {
//        double x = a.x * cos(angle) - a.y * sin(angle);
//        double y = a.x * sin(angle) + a.y * cos(angle);
//        return new Point(x, y);
//    }
    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }
//
//    static Point add(Point a, Point b) {
//        return new Point(a.x + b.x, a.y + b.y);
//    }
//

    /**
     * Cross product ab*ac
     *
     * @param a
     * @param b
     * @param c
     * @return
     */
    static double cross(Point a, Point b, Point c) {
        Point ab = new Point(b.x - a.x, b.y - a.y);
        Point ac = new Point(c.x - a.x, c.y - a.y);
        return cross(ab, ac);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;
    }

    /**
     * Dot product ab*ac;
     *
     * @param a
     * @param b
     * @param c
     * @return
     */
    static long dot(Point a, Point b, Point c) {
        Point ab = new Point(b.x - a.x, b.y - a.y);
        Point ac = new Point(c.x - a.x, c.y - a.y);
        return dot(ab, ac);
    }

    static long dot(Point a, Point b) {
        long total = a.x * b.x;
        total += a.y * b.y;
        return total;
    }

    static double dist(Point a, Point b) {
        long total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
        return Math.sqrt(total);
    }

    static long norm(Point a) {
        long result = a.x * a.x;
        result += a.y * a.y;
        return result;
    }

    static double dist(Point a, Point b, Point x, boolean isSegment) {
        double dist = cross(a, b, x) / dist(a, b);
        // System.out.println("DIST " + dist);

        if (isSegment) {
            Point ab = new Point(b.x - a.x, b.y - a.y);

            long dot1 = dot(a, b, x);
            long norm = norm(ab);
            double u = (double) dot1 / norm;
            if (u < 0) {
                return dist(a, x);
            }

            if (u > 1) {
                return dist(b, x);
            }
        }
        return Math.abs(dist);




    }

    static long squareDist(Point a, Point b) {
        long x = a.x - b.x;
        long y = a.y - b.y;
        return x * x + y * y;
    }

    static class Point {

        int x, y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point{" + "x=" + x + ", y=" + y + '}';
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //br = new BufferedReader(new FileReader(new File("A-large (2).in")));
        }

        public String next() {


            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

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

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

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

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}
