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.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.InputMismatchException;

public class Main {

    IIO io;

    Main(IIO io) {
        this.io = io;
    }

    public static void main(String[] args) throws IOException {

        ConsoleIO io = new ConsoleIO();
        Main m = new Main(io);
        m.solve();
        io.flush();

//        Tester test = new Tester();test.run();
    }

    public void solve() {
        int[][] lines = new int[8][];
        for (int i = 0; i < 8; i++)
            lines[i] = io.readIntArray();
        int[][] perm = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
        long[][] dist2 = new long[7][];
        for (int i = 0; i < 7; i++) {
            dist2[i] = new long[6];
            for (int j = 0; j < 6; j++) {
                int[] p = perm[j];
                long d0 = lines[i][p[0]] - lines[7][0];
                long d1 = lines[i][p[1]] - lines[7][1];
                long d2 = lines[i][p[2]] - lines[7][2];
                dist2[i][j] = d0 * d0 + d1 * d1 + d2 * d2;
            }
        }

        int to = 6 * 6 * 6 * 6 * 6 * 6 * 6;
        int[] idx = new int[7];
        for (int i = 0; i < to; i++) {
            int t = i;
            for (int k = 0; t > 0; k++, t /= 6) idx[k] = t % 6;
            long max = 0;
            for (int k = 0; k < 7; k++) max = Math.max(max, dist2[k][idx[k]]);
            long a = max / 3;
            long b = a + a;
            if (a + b != max)
                continue;
            int an = 0;
            int bn = 0;
            for (int k = 0; k < 7; k++) {
                if (dist2[k][idx[k]] == a) an++;
                if (dist2[k][idx[k]] == b) bn++;
            }
            if (an != 3 || bn != 3)
                continue;
            boolean good = true;
            for (int q = 0; q < 7; q++)
                for (int w = q + 1; w < 7; w++) {
                    int[] p1 = perm[idx[q]];
                    int[] p2 = perm[idx[w]];
                    long d0 = lines[q][p1[0]] - lines[w][p2[0]];
                    long d1 = lines[q][p1[1]] - lines[w][p2[1]];
                    long d2 = lines[q][p1[2]] - lines[w][p2[2]];
                    long d = d0 * d0 + d1 * d1 + d2 * d2;
                    if (d != a && d != b && d != max)
                        good = false;
                }
            if (good) {
                io.writeLine("YES");
                for (int j = 0; j < 7; j++) {
                    int[] p1 = perm[idx[j]];
                    io.writeLine(lines[j][p1[0]] + " " + lines[j][p1[1]] + " " + lines[j][p1[2]]);
                }
                io.writeLine(lines[7][0] + " " + lines[7][1] + " " + lines[7][2]);
                return;
            }
        }

        io.writeLine("NO");
    }

}

class ConsoleIO extends BaseIO {
    BufferedReader br;
    PrintWriter out;
    public ConsoleIO(){
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
    }
    public void flush(){
        this.out.close();
    }
    public void writeLine(String s) {
        this.out.println(s);
    }
    public void writeInt(int a) {
        this.out.print(a);
        this.out.print(' ');
    }
    public void writeWord(String s){
        this.out.print(s);
    }
    public String readLine() {
        try {
            return br.readLine();
        }
        catch (Exception ex){
            return "";
        }
    }
    public int read(){
        try {
            return br.read();
        }
        catch (Exception ex){
            return -1;
        }
    }
}
abstract class BaseIO implements IIO {

    public long readLong() {
        return Long.parseLong(this.readLine());
    }

    public int readInt() {
        return Integer.parseInt(this.readLine());
    }

    public int[] readIntArray() {
        String line = this.readLine();
        String[] nums = line.split(" ");
        int[] res = new int[nums.length];
        for (int i = 0; i < nums.length; i++) {
            res[i] = Integer.parseInt(nums[i]);
        }
        return res;
    }
    public long[] readLongArray() {
        String line = this.readLine();
        String[] nums = line.split(" ");
        long[] res = new long[nums.length];
        for (int i = 0; i < nums.length; i++) {
            res[i] = Long.parseLong(nums[i]);
        }
        return res;
    }
}
interface IIO {
    void writeLine(String s);
    void writeInt(int a);
    void writeWord(String s);
    String readLine();
    long readLong();
    int readInt();
    int read();
    int[] readIntArray();
    long[] readLongArray();
}