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.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.InputStream;

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

class TaskB {
    private static final int NR = 4;
    int N;
    int[][] P;
    int[] st;
    int[] st2;
    boolean[] usedSt;
    long D;
    int[][] SOL;
    boolean OK;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        N = 8;
        P = new int[N][3];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 3; j++) {
                P[i][j] = in.nextInt();
            }
        }

        st = new int[NR];
        usedSt = new boolean[N];
        st2 = new int[NR];
        OK = false;
        SOL = new int[N][3];
        back(0, 0);

        if (!OK) {
            out.println("NO");
        }
        else {
            out.println("YES");
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < 3; j++) {
                    out.print(SOL[i][j] + " ");
                }
                out.println();
            }
        }
    }

    private void back(int p, int c) {
        if (c == NR) {
            check();
            return;
        }
        if (p == N) {
            return;
        }

        for (int i = 0; i < N && !OK; i++) {
            if (usedSt[i]) {
                continue;
            }
            st[c] = i;
            usedSt[i] = true;
            back(i + 1, c + 1);
            usedSt[i] = false;
        }
    }

    private void check() {
        back2(0);
    }

    private void back2(int p) {
        if (p == NR) {
            check2();
            return;
        }

        int k = st[p];
        for (int i = 0; i < 3 && !OK; i++) {
            int aux = P[k][i];
            P[k][i] = P[k][2];
            P[k][2] = aux;
            back2(p + 1);

            int aux2 = P[k][0];
            P[k][0] = P[k][1];
            P[k][1] = aux2;
            back2(p + 1);
            aux2 = P[k][0];
            P[k][0] = P[k][1];
            P[k][1] = aux2;

            aux = P[k][i];
            P[k][i] = P[k][2];
            P[k][2] = aux;
        }
    }

    private void check2() {
        D = calcDist(st[0], st[1]);
        if (D == 0) {
            return;
        }
        for (int i = 1; i < NR; i++) {
            for (int j = 0; j < i; j++) {
                if (eq(st[j], st[i])) {
                    return;
                }
            }
            int next = i + 1;
            if (next == NR) {
                next = 0;
            }
            long crtDist = calcDist(st[i], st[next]);
            if (crtDist != D) {
                return;
            }
        }

        st2 = new int[NR];
        back3(0);
    }

    private boolean eq(int a, int b) {
        for (int i = 0; i < 3; i++) {
            if (P[a][i] != P[b][i]) {
                return false;
            }
        }
        return true;
    }

    private void back3(int p) {
        if (p == NR) {
            check3();
            return;
        }

        for (int i = 0; i < N && !OK; i++) {
            if (usedSt[i]) {
                continue;
            }

            int k = i;
            for (int ii = 0; ii < 3 && !OK; ii++) {
                int aux = P[k][ii];
                P[k][ii] = P[k][2];
                P[k][2] = aux;
                long dist = calcDist(st[p], i);
                if (dist == D) {
                    usedSt[i] = true;
                    st2[p] = i;
                    back3(p + 1);
                    usedSt[i] = false;
                }

                int aux2 = P[k][0];
                P[k][0] = P[k][1];
                P[k][1] = aux2;
                dist = calcDist(st[p], i);
                if (dist == D) {
                    usedSt[i] = true;
                    st2[p] = i;
                    back3(p + 1);
                    usedSt[i] = false;
                }

                aux2 = P[k][0];
                P[k][0] = P[k][1];
                P[k][1] = aux2;

                aux = P[k][ii];
                P[k][ii] = P[k][2];
                P[k][2] = aux;
            }
        }
    }

    private void check3() {
        for (int i = 0; i < NR; i++) {
            for (int j = 0; j < i; j++) {
                if (eq(st2[j], st2[i])) {
                    return;
                }
            }
            for (int j = 0; j < NR; j++) {
                if (eq(st[j], st2[i])) {
                    return;
                }
            }
            int next = i + 1;
            if (next == NR) {
                next = 0;
            }
            long crtDist = calcDist(st2[i], st2[next]);
            if (crtDist != D) {
                return;
            }
        }

        OK = true;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 3; j++) {
                SOL[i][j] = P[i][j];
            }
        }
    }

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

}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(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 int nextInt() {
        return Integer.parseInt(nextString());
    }

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));

        return res.toString();
    }

    private boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

}