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.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Solution {
    static class Vector {
        long x, y, z;

        public Vector() {
        }

        public Vector(long x, long y, long z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Vector vector = (Vector) o;

            return x == vector.x && y == vector.y && z == vector.z;

        }

        @Override
        public int hashCode() {
            int result = (int) (x ^ (x >>> 32));
            result = 31 * result + (int) (y ^ (y >>> 32));
            result = 31 * result + (int) (z ^ (z >>> 32));
            return result;
        }

        @Override
        public String toString() {
            return x + " " + y + " " + z;
        }

        Vector add(Vector that) {
            return new Vector(this.x + that.x, this.y + that.y, this.z + that.z);
        }

        Vector subtract(Vector that) {
            return new Vector(this.x - that.x, this.y - that.y, this.z - that.z);
        }

        Vector vectorProduct(Vector that) {
            return new Vector(
                    this.y * that.z - this.z * that.y,
                    this.z * that.x - this.x * that.z,
                    this.x * that.y - this.y * that.x
            );
        }

        long scalarProduct(Vector that) {
            return this.x * that.x + this.y * that.y + this.z * that.z;
        }
    }

    public static void main(String[] args) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            PrintWriter writer = new PrintWriter(System.out)) {
            List<Set<Vector>> points = new ArrayList<>();
            for (int i = 0; i < 8; i++) {
                Set<Vector> permutations = new HashSet<>();
                points.add(permutations);
                generatePointVectors(
                        Stream.of(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(),
                        permutations::add);
            }
            Vector[] answer = new Vector[8];
            for (Vector O : points.get(0)) {
                answer[0] = O;
                for (int i = 1; i < 8; i++) {
                    for (int j = i + 1; j < 8; j++) {
                        for (Vector A : points.get(i)) {
                            answer[i] = A;
                            Vector a = A.subtract(O);
                            if (a.scalarProduct(a) == 0) {
                                continue;
                            }
                            for (Vector B : points.get(j)) {
                                answer[j] = B;
                                Vector b = B.subtract(O);
                                if (a.scalarProduct(b) != 0 || a.scalarProduct(a) != b.scalarProduct(b)) {
                                    continue;
                                }
                                Vector[] ab = {a, b};
                                for (int abIndex = 0; abIndex < 2; abIndex++) {
                                    Vector c = ab[abIndex].vectorProduct(ab[1 ^ abIndex]);
                                    double aLen = Math.sqrt(a.scalarProduct(a));
                                    double cx = c.x / aLen, cy = c.y / aLen, cz = c.z / aLen;
                                    c = new Vector(toInt(cx), toInt(cy), toInt(cz));
                                    if (!equal(c.x, cx) || !equal(c.y, cy) || !equal(c.z, cz)) {
                                        continue;
                                    }
                                    Vector C = O.add(c);
                                    Vector AB = A.add(b);
                                    Vector BC = B.add(c);
                                    Vector AC = A.add(c);
                                    Vector ABC = AB.add(c);
                                    int mask = 1 + (1 << i) + (1 << j);
                                    Vector[] toCover = {C, AB, BC, AC, ABC};
                                    for (Vector V : toCover) {
                                        int covering = 0;
                                        for (int k = 1; k < 8; k++) {
                                            if ((mask >> k) % 2 == 0) {
                                                if (points.get(k).contains(V)) {
                                                    covering = k;
                                                    answer[k] = V;
                                                    break;
                                                }
                                            }
                                        }
                                        if (covering == 0) {
                                            break;
                                        }
                                        mask += 1 << covering;
                                    }
                                    if (mask == (1 << 8) - 1) {
                                        writer.println("YES");
                                        Stream.of(answer).forEach(writer::println);
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            writer.println("NO");
        }
    }

    static void generatePointVectors(int[] a, Consumer<Vector> onGenerated) {
        generatePointVectors(a, new int[3], 0, onGenerated);
    }

    static void generatePointVectors(int[] a, int[] b, int mask, Consumer<Vector> onGenerated) {
        if (mask == 7) {
            onGenerated.accept(new Vector(b[0], b[1], b[2]));
        } else {
            for (int i = 0; i < 3; i++) {
                if ((mask >> i) % 2 == 0) {
                    b[Integer.bitCount(mask)] = a[i];
                    generatePointVectors(a, b, mask + (1 << i), onGenerated);
                }
            }
        }
    }

    static boolean equal(double a, double b) {
        return Math.abs(a - b) < 1e-5;
    }

    static int toInt(double d) {
        return d > 0 ? (int)(d + 0.5) : -(int)(-d + 0.5);
    }
}