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 B {
    public static void main(String[] args) throws Exception {
        new B().solve();
    }

    void solve() throws IOException {
        FastScanner in = new FastScanner(System.in);

        long[][] z = new long[8][3];
        {
            for (int i = 0; i < 8; i++) {
                for (int jj = 0; jj < 3; jj++) {
                    z[i][jj] = in.nextLong();
                }
            }
        }
        int[][] p = new int[6][3];
        {
            int[] tmp = new int[] { 0, 1, 2 };
            for (int i = 0; i < 6; i++) {
                for (int jj = 0; jj < 3; jj++) {
                    p[i][jj] = tmp[jj];
                }
                next_permutation(tmp);
            }
        }

        long[][] r = new long[8][3];
        r[0] = z[0];
        for (int i1 = 1; i1 < 8; i1++) {
            for (int p1 = 0; p1 < 6; p1++) {
                ma(z[i1], p[p1], r[1]);

                for (int i2 = i1 + 1; i2 < 8; i2++) {
                    for (int p2 = 0; p2 < 6; p2++) {
                        ma(z[i2], p[p2], r[2]);

                        for (int i3 = i2 + 1; i3 < 8; i3++) {
                            for (int p3 = 0; p3 < 6; p3++) {
                                ma(z[i3], p[p3], r[3]);

                                long len2 = d2(r[0], r[1]);
                                if (len2 != 0 &&
                                        d2(r[0], r[2]) == len2 &&
                                        d2(r[0], r[3]) == len2 &&
                                        d2(r[1], r[2]) == 2 * len2 &&
                                        d2(r[2], r[3]) == 2 * len2 &&
                                        d2(r[3], r[1]) == 2 * len2) {
                                    // ok!!

                                    as(r[2], r[3], r[0], r[4]);
                                    as(r[3], r[1], r[0], r[5]);
                                    as(r[1], r[2], r[0], r[6]);

                                    as(r[6], r[3], r[0], r[7]);


                                    int[] i4 = new int[4];
                                    {
                                        int idx = 0;
                                        for (int i = 1; i < 8; i++) {
                                            if (i != i1 && i != i2 && i != i3) {
                                                i4[idx++] = i;
                                            }
                                        }
                                    }

                                    do {
                                        boolean ok = true;
                                        for (int i = 0; i < 4; i++) {
                                            if (!match(r[4 + i], z[i4[i]])) {
                                                ok = false;
                                                break;
                                            }
                                        }
                                        if (ok) {

                                            long[][] ret = new long[8][3];
                                            ret[0] = r[0];
                                            ret[i1] = r[1];
                                            ret[i2] = r[2];
                                            ret[i3] = r[3];
                                            for (int i = 0; i < 4; i++) {
                                                ret[i4[i]] = r[4 + i];
                                            }


                                            // ////////////////////////////////
                                            System.out.println("YES");
                                            for (int i = 0; i < 8; i++) {
                                                System.out.println(ret[i][0] + " " + ret[i][1] + " " + ret[i][2]);
                                            }
                                            return;
                                            // /////////////////////////////////
                                        }

                                    } while (next_permutation(i4));
                                }
                            }
                        }
                    }
                }
            }
        }
        System.out.println("NO");
    }

    boolean match(long[] a, long[] b) {
        int[] p = new int[] { 0, 1, 2 };

        do {
            boolean ok = true;

            for (int jj = 0; jj < 3; jj++) {
                if (a[p[jj]] != b[jj]) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                return true;
            }
        } while (next_permutation(p));

        return false;
    }


    // ret= a+b-c
    void as(long[] a, long[] b, long[] c, long[] ret) {
        for (int i = 0; i < a.length; i++) {
            ret[i] = a[i] + b[i] - c[i];
        }
    }

    void ma(long[] a, int[] p, long[] ret) {
        for (int i = 0; i < a.length; i++) {
            ret[p[i]] = a[i];
        }
    }

    long d2(long[] t1, long[] t2) {
        long x = t2[0] - t1[0];
        long y = t2[1] - t1[1];
        long z = t2[2] - t1[2];

        return x * x + y * y + z * z;
    }


    // ////////////////////////////////////
    // next_permutation
    boolean next_permutation(int[] p) {
        int n = p.length;
        int i1, i2;
        for (i1 = n - 2; i1 >= 0 && p[i1] > p[i1 + 1]; i1--) {}
        if (i1 == -1) {
            p = null;
            return false;
        }
        for (i2 = n - 1; p[i1] > p[i2]; i2--) {}
        int tmp = p[i1];
        p[i1] = p[i2];
        p[i2] = tmp;
        for (int i = i1 + 1; i < i1 + n - i; i++) {
            int j = i1 + n - i;
            tmp = p[i];
            p[i] = p[j];
            p[j] = tmp;
        }
        return true;
    }









    class FastScanner {

        private InputStream _stream;
        private byte[] _buf = new byte[1024];
        private int _curChar;
        private int _numChars;
        private StringBuilder _sb = new StringBuilder();

        FastScanner(InputStream stream) {
            this._stream = stream;
        }

        public int read() {
            if (_numChars == -1) throw new InputMismatchException();
            if (_curChar >= _numChars) {
                _curChar = 0;
                try {
                    _numChars = _stream.read(_buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (_numChars <= 0) return -1;
            }
            return _buf[_curChar++];
        }

        public String next() {
            int c = read();
            while (isWhitespace(c)) {
                c = read();
            }
            _sb.setLength(0);
            do {
                _sb.appendCodePoint(c);
                c = read();
            } while (!isWhitespace(c));
            return _sb.toString();
        }

        public int nextInt() {
            return (int) nextLong();
        }
        public long nextLong() {
            int c = read();
            while (isWhitespace(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sgn;
        }

        public boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//