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 static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;

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

public class Main {

    public static void main(String[] args) throws IOException {
        try {
            if (new File("input.txt").exists())
                System.setIn(new FileInputStream("input.txt"));
        } catch (SecurityException e) {
        }
        new Main().run();
    }

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    final double EPS = 1e-9;

    class Point {
        long x, y, z;

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

        long dist2(Point o) {
            return (x - o.x) * (x - o.x) + (y - o.y) * (y - o.y) + (z - o.z)
                    * (z - o.z);
        }

        @Override
        public String toString() {
            return x + " " + y + " " + z;
        }
    }

    Point[] verify = new Point[8];
    Point[] buffer = new Point[8];
    boolean[] used = new boolean[8];

    boolean dfs(int k) {
        if (k == 8) {
            int i1 = 0, i2 = 1, i3 = 2, i4 = 3, i5 = 4, i6 = 5, i7 = 6, i8 = 7;
            long len2 = buffer[i1].dist2(buffer[i2]);
            long diagSquare = len2 * 2;
            long diagCube = len2 * 3;
            return len2 != 0 && diagCube != 0 && diagSquare != 0
                    && buffer[i3].dist2(buffer[i2]) == len2
                    && buffer[i3].dist2(buffer[i1]) == diagSquare

                    && buffer[i4].dist2(buffer[i3]) == len2
                    && buffer[i4].dist2(buffer[i1]) == len2
                    && buffer[i4].dist2(buffer[i2]) == diagSquare

                    && buffer[i5].dist2(buffer[i4]) == len2
                    && buffer[i5].dist2(buffer[i1]) == diagSquare
                    && buffer[i5].dist2(buffer[i3]) == diagSquare
                    && buffer[i5].dist2(buffer[i2]) == diagCube

                    && buffer[i6].dist2(buffer[i3]) == len2
                    && buffer[i6].dist2(buffer[i5]) == len2
                    && buffer[i6].dist2(buffer[i4]) == diagSquare
                    && buffer[i6].dist2(buffer[i2]) == diagSquare
                    && buffer[i6].dist2(buffer[i1]) == diagCube

                    && buffer[i7].dist2(buffer[i2]) == len2
                    && buffer[i7].dist2(buffer[i6]) == len2
                    && buffer[i7].dist2(buffer[i3]) == diagSquare
                    && buffer[i7].dist2(buffer[i1]) == diagSquare
                    && buffer[i7].dist2(buffer[i5]) == diagSquare
                    && buffer[i7].dist2(buffer[i4]) == diagCube

                    && buffer[i8].dist2(buffer[i1]) == len2
                    && buffer[i8].dist2(buffer[i7]) == len2
                    && buffer[i8].dist2(buffer[i5]) == len2
                    && buffer[i8].dist2(buffer[i4]) == diagSquare
                    && buffer[i8].dist2(buffer[i2]) == diagSquare
                    && buffer[i8].dist2(buffer[i6]) == diagSquare
                    && buffer[i8].dist2(buffer[i3]) == diagCube;
        } else {
            for (int i = 0; i < 8; i++)
                if (!used[i]) {
                    buffer[k] = verify[i];

                    used[i] = true;
                    if (dfs(k + 1))
                        return true;
                    used[i] = false;
                }
        }
        return false;
    }
    
    void add(long a, TreeMap<Long, Integer> map) {
        if(map.containsKey(a))
            map.put(a, map.get(a) + 1);
        else
            map.put(a, 1);
    }
    
    void remove(long a, TreeMap<Long, Integer> map) {
        if(map.containsKey(a))
            if(map.get(a) == 1)
                map.remove(a);
            else
                map.put(a, map.get(a) - 1);
    }

    private void solve() throws IOException {
        Point[] p = new Point[8];
        for (int i = 0; i < 8; i++)
            p[i] = new Point(nextLong(), nextLong(), nextLong());

        Point[] allP = new Point[48];
        int cnt = 0;
        for (int i = 0; i < 8; i++) {
            allP[cnt++] = new Point(p[i].x, p[i].y, p[i].z);
            allP[cnt++] = new Point(p[i].x, p[i].z, p[i].y);

            allP[cnt++] = new Point(p[i].y, p[i].x, p[i].z);
            allP[cnt++] = new Point(p[i].y, p[i].z, p[i].x);

            allP[cnt++] = new Point(p[i].z, p[i].y, p[i].x);
            allP[cnt++] = new Point(p[i].z, p[i].x, p[i].y);
        }

        fill(used, false);
        TreeMap<Long, Integer> map = new TreeMap<Long, Integer>();
        for (int i1 = 0; i1 < 6; i1++) {
            for (int i2 = 6; i2 < 12; i2++) {
                for (int i3 = 12; i3 < 18; i3++) {
                    for (int i4 = 18; i4 < 24; i4++) {
                        
                        long l1 = allP[i1].dist2(allP[i2]);
                        long l2 = allP[i1].dist2(allP[i3]);
                        long l3 = allP[i1].dist2(allP[i4]);

                        long l4 = allP[i2].dist2(allP[i3]);
                        long l5 = allP[i2].dist2(allP[i4]);

                        long l6 = allP[i3].dist2(allP[i4]);

                        map.clear();
                        add(l1, map);
                        add(l2, map);
                        add(l3, map);
                        add(l4, map);
                        add(l5, map);
                        add(l6, map);
                        
                        if (map.size() <= 3 && map.size() >= 2 && !map.containsKey(0L)) {
                            for (int i5 = 24; i5 < 30; i5++) {
                                add(allP[i5].dist2(allP[i1]), map);
                                add(allP[i5].dist2(allP[i2]), map);
                                add(allP[i5].dist2(allP[i3]), map);
                                add(allP[i5].dist2(allP[i4]), map);

                                if (map.size() <= 3 && map.size() >= 2 && !map.containsKey(0L)) {
                                    for (int i6 = 30; i6 < 36; i6++) {
                                        add(allP[i6].dist2(allP[i1]),map);
                                        add(allP[i6].dist2(allP[i2]),map);
                                        add(allP[i6].dist2(allP[i3]),map);
                                        add(allP[i6].dist2(allP[i4]),map);
                                        add(allP[i6].dist2(allP[i5]),map);

                                        if (map.size() <= 3 && map.size() >= 2 && !map.containsKey(0L)) {
                                            for (int i7 = 36; i7 < 42; i7++) {
                                                add(allP[i7].dist2(allP[i1]),map);
                                                add(allP[i7].dist2(allP[i2]),map);
                                                add(allP[i7].dist2(allP[i3]),map);
                                                add(allP[i7].dist2(allP[i4]),map);
                                                add(allP[i7].dist2(allP[i5]),map);
                                                add(allP[i7].dist2(allP[i6]),map);

                                                if (map.size() <= 3 && map.size() >= 2 && !map.containsKey(0L)) {
                                                    for (int i8 = 42; i8 < 48; i8++) {
                                                        add(allP[i8].dist2(allP[i1]),map);
                                                        add(allP[i8].dist2(allP[i2]),map);
                                                        add(allP[i8].dist2(allP[i3]),map);
                                                        add(allP[i8].dist2(allP[i4]),map);
                                                        add(allP[i8].dist2(allP[i5]),map);
                                                        add(allP[i8].dist2(allP[i6]),map);
                                                        add(allP[i8].dist2(allP[i7]),map);

                                                        if (map.size() <= 3 && map.size() >= 2 && !map.containsKey(0L)) {
                                                            verify[0] = allP[i1];
                                                            verify[1] = allP[i2];
                                                            verify[2] = allP[i3];
                                                            verify[3] = allP[i4];

                                                            verify[4] = allP[i5];
                                                            verify[5] = allP[i6];
                                                            verify[6] = allP[i7];
                                                            verify[7] = allP[i8];
                                                            if (dfs(0)) {
                                                                out.println("YES");
                                                                out.println(allP[i1]);
                                                                out.println(allP[i2]);
                                                                out.println(allP[i3]);
                                                                out.println(allP[i4]);

                                                                out.println(allP[i5]);
                                                                out.println(allP[i6]);
                                                                out.println(allP[i7]);
                                                                out.println(allP[i8]);
                                                                return;
                                                            }
                                                        }
                                                        
                                                        remove(allP[i8].dist2(allP[i1]),map);
                                                        remove(allP[i8].dist2(allP[i2]),map);
                                                        remove(allP[i8].dist2(allP[i3]),map);
                                                        remove(allP[i8].dist2(allP[i4]),map);
                                                        remove(allP[i8].dist2(allP[i5]),map);
                                                        remove(allP[i8].dist2(allP[i6]),map);
                                                        remove(allP[i8].dist2(allP[i7]),map);
                                                    }
                                                }
                                                
                                                remove(allP[i7].dist2(allP[i1]),map);
                                                remove(allP[i7].dist2(allP[i2]),map);
                                                remove(allP[i7].dist2(allP[i3]),map);
                                                remove(allP[i7].dist2(allP[i4]),map);
                                                remove(allP[i7].dist2(allP[i5]),map);
                                                remove(allP[i7].dist2(allP[i6]),map);
                                            }
                                        }
                                        

                                        remove(allP[i6].dist2(allP[i1]),map);
                                        remove(allP[i6].dist2(allP[i2]),map);
                                        remove(allP[i6].dist2(allP[i3]),map);
                                        remove(allP[i6].dist2(allP[i4]),map);
                                        remove(allP[i6].dist2(allP[i5]),map);
                                    }
                                }
                                
                                

                                remove(allP[i5].dist2(allP[i1]), map);
                                remove(allP[i5].dist2(allP[i2]), map);
                                remove(allP[i5].dist2(allP[i3]), map);
                                remove(allP[i5].dist2(allP[i4]), map);
                            }
                        }
                    }
                }
            }
        }
        out.println("NO");

    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    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 nextLine() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

    boolean EOF() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return true;
            st = new StringTokenizer(s);
        }
        return false;
    }
}