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.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * Created by hama_du on 2014/09/09.
 */
public class ProblemB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        num = new int[8][3];
        for (int i = 0 ; i < 8 ; i++) {
            for (int j = 0 ; j < 3 ; j++) {
                num[i][j] = in.nextInt();
            }
            Arrays.sort(num[i]);
        }

        boolean ok = false;
        for (int v = 0 ; v < (1<<8) ; v++) {
            if (Integer.bitCount(v) == 4) {
                int[] k = new int[4];
                int[] o = new int[4];
                int ki = 0;
                int oi = 0;
                for (int f = 0 ; f < 8 ; f++) {
                    if ((v & (1<<f)) >= 1) {
                        k[ki++] = f;
                    } else {
                        o[oi++] = f;
                    }
                }
                if (isOK(k, o, 0, new int[4])) {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            out.println("YES");
            for (int i = 0 ; i < 8 ; i++) {
                out.println(ans[i][0] + " " + ans[i][1] + " " + ans[i][2]);
            }
        } else {
            out.println("NO");
        }


        out.flush();
    }

    static long[][] ans;

    static int[][] num;

    static int[][] smap = {
            {0, 1, 2},
            {0, 2, 1},
            {1, 0, 2},
            {1, 2, 0},
            {2, 0, 1},
            {2, 1, 0}
    };

    static boolean isOK(int[] k, int[] o, int idx, int[] p) {
        if (idx == 4) {
            return checkIt(k, o, p);
        }
        for (int d = 0 ; d < 6 ; d++) {
            p[idx] = d;
            if (isOK(k, o, idx+1, p)) {
                return true;
            }
        }
        return false;
    }

    private static boolean checkIt(int[] k, int[] o, int[] p) {
        long[][] g = new long[8][3];
        for (int i = 0 ; i < 4 ; i++) {
            for (int j = 0 ; j < 3 ; j++) {
                g[i][j] = num[k[i]][smap[p[i]][j]];
            }
        }


        for (int b = 0 ; b < 4 ; b++) {
            long[] d = {0, 0, 0};
            long[] dx = {0, 0, 0};
            long[] dy = {0, 0, 0};
            long[] dz = {0, 0, 0};
            for (int c = 0 ; c < 4 ; c++) {
                if (b == c) {
                    continue;
                }
                int cidx = (c > b) ? c-1 : c;
                dx[cidx] = g[c][0] - g[b][0];
                dy[cidx] = g[c][1] - g[b][1];
                dz[cidx] = g[c][2] - g[b][2];
                d[cidx] = dx[cidx]*dx[cidx]+dy[cidx]*dy[cidx]+dz[cidx]*dz[cidx];
            }
            if (d[0] == d[1] && d[1] == d[2] && d[0] == d[2] && d[0] > 0) {
                boolean isok = true;
                for (int u = 0 ; u < 3 ; u++) {
                    for (int v = u+1 ; v < 3 ; v++) {
                        long dot = dx[u] * dx[v] + dy[u] * dy[v] + dz[u] * dz[v];
                        if (dot != 0) {
                            isok = false;
                            break;
                        }
                    }
                }
                if (isok) {
                    ans = new long[8][3];

                    g[4][0] = g[b][0] + dx[0] + dx[1];
                    g[4][1] = g[b][1] + dy[0] + dy[1];
                    g[4][2] = g[b][2] + dz[0] + dz[1];

                    g[5][0] = g[b][0] + dx[0] + dx[2];
                    g[5][1] = g[b][1] + dy[0] + dy[2];
                    g[5][2] = g[b][2] + dz[0] + dz[2];

                    g[6][0] = g[b][0] + dx[1] + dx[2];
                    g[6][1] = g[b][1] + dy[1] + dy[2];
                    g[6][2] = g[b][2] + dz[1] + dz[2];

                    g[7][0] = g[b][0] + dx[0] + dx[1] + dx[2];
                    g[7][1] = g[b][1] + dy[0] + dy[1] + dy[2];
                    g[7][2] = g[b][2] + dz[0] + dz[1] + dz[2];


                    int done = 0;
                    for (int f = 4 ; f < 8 ; f++) {
                        long[] e = g[f].clone();
                        Arrays.sort(e);
                        for (int z = 0 ; z < 4 ; z++) {
                            if ((done & (1<<z)) == 0) {
                                int[] n = num[o[z]];
                                if (n[0] == e[0] && n[1] == e[1] && n[2] == e[2]) {
                                    done |= 1<<z;
                                    ans[o[z]] = g[f];
                                    break;
                                }
                            }
                        }
                    }
                    if (done == 15) {
                        for (int f = 0 ; f < 4 ; f++) {
                            ans[k[f]] = g[f];
                        }
                        return true;
                    }
                }
            }
        }
        return false;
    }


    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }

}