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.util.ArrayList;
import java.io.InputStream;
import java.util.List;
import java.util.Scanner;
import java.io.PrintStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Collections;
import java.io.IOException;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author about@manhquynh.net
 */
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);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    private int[] trying = new int[8];
    private int[][] list = new int[8][3];
    int[][] initialize = new int[][]{
            {0, 1, 2},
            {0, 2, 1},
            {1, 0, 2},
            {1, 2, 0},
            {2, 0, 1},
            {2, 1, 0}
    };
    public void solve(int testNumber, Scanner in, PrintWriter out) {

        for (int i = 0; i < 8; ++i)
            for (int j = 0; j < 3; ++j)
                list[i][j] = in.nextInt();

        backTrack(0);
        System.out.print("NO");
    }

    void backTrack(int id) {
        if (id == 8) {
//            System.out.println(id);
            long[][] check = new long[8][3];
//            trying = new int[]{4, 1, 3, 2, 0, 3, 5, 2};
            for (int i = 0; i < 8; ++i)
                for (int j = 0; j < 3; ++j)
                    check[i][j] = list[i][initialize[trying[i]][j]];

            ArrayList<ArrayList<Long>> distance = new ArrayList<ArrayList<Long>>();
            for (int i = 0; i < 8; ++i)
                distance.add(new ArrayList<Long>());
            for (int i = 0; i < 8; ++i)
                for (int j = 0; j < 8; ++j)
                    if (i != j)
                        distance.get(i).add((check[i][0] - check[j][0]) * (check[i][0] - check[j][0]) + (check[i][1] - check[j][1]) * (check[i][1] - check[j][1]) + (check[i][2] - check[j][2]) * (check[i][2] - check[j][2]));
            for (int i = 0; i <8; ++i)
                Collections.sort(distance.get(i));
//            for (int i = 0; i < 8; ++i) {
//                for (int j = 0; j < 7; ++j)
//                    System.out.print(distance.get(i).get(j) + " ");
//                System.out.println();
//            }
            for (int i = 0; i < 7; ++i) {
                ArrayList<Long> increase = new ArrayList<Long>();
                for (int j = 0; j < 8; ++j)
                    increase.add(distance.get(j).get(i));
                Collections.sort(increase);
                if ((long)increase.get(0) != (long)increase.get(7))
                    return;
            }

            if ((long)distance.get(0).get(0) == (long)distance.get(0).get(2)) {
                if ((long)distance.get(0).get(3) == (long)distance.get(0).get(5) && (long)distance.get(0).get(3) != (long)distance.get(0).get(2)) {
                    if ((long)distance.get(0).get(5) != (long)distance.get(0).get(6)) {
                        if ((long)distance.get(0).get(0) * 2 == (long)distance.get(0).get(3) && (long)distance.get(0).get(0) * 3 == (long)distance.get(0).get(6)) {
                            System.out.println("YES");
                            for (int i = 0; i < 8; ++i) {
                                for (int j = 0; j < 3; ++j)
                                    System.out.print(check[i][j] + " ");
                                System.out.println();
                            }
                            System.exit(0);
                        } else
                            return;
                    } else
                        return;
                } else
                    return;

            } else
                return;
            return;
        }

        for (int j = 0; j <= 5; ++j) {
            trying[id] = j;
//            trying = new int[]{0, 5, 0, 4, 4, 0, 5, 0};
//            trying = new int[]{4, 1, 3, 2, 0, 3, 5, 2};
//            System.out.println(id);
            if (id > 1) {
                long[] three = new long[3];
                long[] third = new long[3];
                long[] march = new long[3];
                for (int t = 0; t < 3; ++t) {
                    three[t] = list[id][initialize[trying[id]][t]];
                    third[t] = list[id - 1][initialize[trying[id - 1]][t]];
                    march[t] = list[id - 2][initialize[trying[id - 2]][t]];
//                    System.out.println(three[t] + " " + third[t] + " " + march[t]);
                }
//                System.out.println();
                long distance1 = (three[0] - third[0]) * (three[0] - third[0]) + (three[1] - third[1]) * (three[1] - third[1]) + (three[2] - third[2]) * (three[2] - third[2]);
                long distance2 = (three[0] - march[0]) * (three[0] - march[0]) + (three[1] - march[1]) * (three[1] - march[1]) + (three[2] - march[2]) * (three[2] - march[2]);
                long distance3 = (march[0] - third[0]) * (march[0] - third[0]) + (march[1] - third[1]) * (march[1] - third[1]) + (march[2] - third[2]) * (march[2] - third[2]);
                long[] arrange = new long[] {distance1, distance2, distance3};
                Arrays.sort(arrange);
                if (arrange[0] == 0 || arrange[1] == 0 || arrange[2] == 0)
                    continue;
                if ((arrange[0] == 0) || (arrange[0] != arrange[1] && arrange[0] * 2 != arrange[1] && arrange[0] * 3 != arrange[1] && arrange[0] * 3 != arrange[1] * 2))
                    continue;
                if ((arrange[1] == 0) || (arrange[1] != arrange[2] && arrange[1] * 2 != arrange[2] && arrange[1] * 3 != arrange[2] && arrange[1] * 3 != arrange[2] * 2))
                    continue;
            }
            backTrack(id + 1);
        }
    }
}