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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;


public class B {
    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int[][] perms = new int[6][];
    long[][] points = new long[8][3];
    boolean found = false;
    public void solve() throws IOException {
        perms[0] = new int[] {0, 1, 2};
        perms[1] = new int[] {0, 2, 1};
        perms[2] = new int[] {1, 0, 2};
        perms[3] = new int[] {1, 2, 0};
        perms[4] = new int[] {2, 0, 1};
        perms[5] = new int[] {2, 1, 0};

        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 3; j++) {
                points[i][j] = nextInt();
            }
        }

        go(1, new int[8]);

        if (!found) {
            out.println("NO");
        }
    }

    public long calc_distance(long[] p1, long[] p2) {
        long sum = 0;
        for (int i = 0; i < 3; i++) {
            sum += (p1[i] - p2[i]) * (p1[i] - p2[i]);
        }
        return sum;
    }

    public boolean check(long[][] points) {
        HashMap<Long, Integer> dCount = new HashMap<Long, Integer>();
        long[][] distances = new long[8][8];
        for (int i = 0; i < 8; i++) {
            for (int j = i+1; j < 8; j++) {
                long d = calc_distance(points[i], points[j]);
                distances[i][j] = d;

                if (!dCount.containsKey(d)) {
                    dCount.put(d, 1);
                } else {
                    dCount.put(d, dCount.get(d)+1);
                }

                if (dCount.size() > 3) return false;
            }
        }

        if (dCount.size() != 3) return false;

        ArrayList<Long> lens = new ArrayList<Long>();
        for (long d: dCount.keySet()) {
            lens.add(d);
        }
        Collections.sort(lens);

//        out.println(dCount.get(lens.get(0)) +", " + dCount.get(lens.get(1)) + ", " + dCount.get(lens.get(2)));

        if (dCount.get(lens.get(0)) != 12) return false;
        if (dCount.get(lens.get(1)) != 12) return false;
        if (dCount.get(lens.get(2)) != 4) return false;

        return true;
    }

    public void go(int cur, int[] pos) {
        if (found) return;

        if (cur == 8) {
            long[][] nPoints = new long[8][3];
            for (int i = 0; i < 8; i++) {
                int[] perm = perms[pos[i]];
                for (int j = 0; j < 3; j++) {
                    nPoints[i][j] = points[i][ perm[j] ];
                }
            }

            if (check(nPoints)) {
                out.println("YES");
                for (int i = 0; i < 8; i++) {
                    for (int j = 0; j < 3; j++) {
                        out.print(nPoints[i][j] + " ");
                    }
                    out.println();
                }

                found = true;
            }

            return;
        }

        for (int p = 0; p < 6; p++) {
            pos[cur] = p;
            go(cur+1, pos);
        }
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        new B().run();
    }

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    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 nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}