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.util.Arrays;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.List;
import java.math.BigInteger;
import java.io.PrintStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Comparator;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author shu_mj @ http://shu-mj.com
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    Scanner in;
    PrintWriter out;

    public void solve(int testNumber, Scanner in, PrintWriter out) {
        this.in = in;
        this.out = out;
        run();
    }

    void run() {
        int[][] iss = in.nextIntMatrix(8, 3);
        for (int[] is : iss) Arrays.sort(is);
//        do {
            do {
                do {
                    do {
                        do {
                            do {
                                do {
                                    do {
                                        if (fit(iss)) {
                                            out.println("YES");
                                            for (int[] is : iss) {
                                                out.println(is[0] + " " + is[1] + " " + is[2]);
                                            }
                                            return ;
                                        }
                                    } while (Algo.nextPermutation(iss[7]));
                                } while (Algo.nextPermutation(iss[6]));
                            } while (Algo.nextPermutation(iss[5]));
                        } while (Algo.nextPermutation(iss[4]));
                    } while (Algo.nextPermutation(iss[3]));
                } while (Algo.nextPermutation(iss[2]));
            } while (Algo.nextPermutation(iss[1]));
//        } while (Algo.nextPermutation(iss[0]));
        out.println("NO");
    }

    private boolean fit(int[][] iss) {
        long[] ds = { -1, -1, -1 };
        for (int i = 1; i < 8; i++) {
            long d = dis(iss[0], iss[i]);
            if (ds[0] == -1) ds[0] = d;
            if (ds[0] == d) continue;
            if (ds[1] == -1) ds[1] = d;
            if (ds[1] == d) continue;
            if (ds[2] == -1) ds[2] = d;
            if (ds[2] == d) continue;
            return false;
        }
        Arrays.sort(ds);
        long a = ds[0];
        long b = ds[1];
        long c = ds[2];
        if (a <= 0) return false;
        int ca, cb, cc;
//        long[][] dis = new long[8][8];
        for (int i = 0; i < 8; i++) {
            ca = cb = cc = 0;
            for (int j = 0; j < 8; j++) if (i != j) {
//                if (dis[i][j] == 0) dis[i][j] = dis[j][i] = dis(iss[i], iss[j]);
//                long d = dis[i][j];
                long d = dis(iss[i], iss[j]);
                if (d == a) ca++;
                if (d == b) cb++;
                if (d == c) cc++;
            }
            if (ca != 3 || cb != 3 || cc != 1) return false;
        }
        return true;
    }

    private long dis(int[] a, int[] b) {
        long x = a[0] - b[0];
        long y = a[1] - b[1];
        long z = a[2] - b[2];
        return x * x + y * y + z * z;
    }
}

class Scanner {
    BufferedReader br;
    StringTokenizer st;

    public Scanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(in));
        eat("");
    }

    private void eat(String s) {
        st = new StringTokenizer(s);
    }

    public String nextLine() {
        try {
            return br.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    public boolean hasNext() {
        while (!st.hasMoreTokens()) {
            String s = nextLine();
            if (s == null)
                return false;
            eat(s);
        }
        return true;
    }

    public String next() {
        hasNext();
        return st.nextToken();
    }

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

    public int[] nextIntArray(int n) {
        int[] is = new int[n];
        for (int i = 0; i < n; i++) {
            is[i] = nextInt();
        }
        return is;
    }

    public int[][] nextIntMatrix(int row, int col) {
        int[][] mat = new int[row][];
        for (int i = 0; i < row; i++) {
            mat[i] = nextIntArray(col);
        }
        return mat;
    }

}

class Algo {


    public static void swap(int[] is, int i, int j) {
        int t = is[i]; is[i] = is[j]; is[j] = t;
    }

    public static void reverse(int[] is, int b, int e) {
        while (b < e) swap(is, b++, --e);
    }

    public static boolean nextPermutation(int[] is) {
        int n = is.length;
        for (int i = n - 1; i > 0; i--) {
            if (is[i - 1] < is[i]) {
                int j = n;
                while (is[i - 1] >= is[--j]) ;
                swap(is, i - 1, j);
                reverse(is, i, n);
                return true;
            }
        }
        reverse(is, 0, n);
        return false;
    }

}