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.*;

public class Solution464B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Cube cube = new Cube();
        for (int i = 0; i < 8; i++) {
            cube.addPoint(new Point(in.nextInt(), in.nextInt(), in.nextInt()));
        }
        solve(cube, 0);
        if (!done) {
            System.out.println("NO");
        }
    }

    static boolean done = false;
//    static Set<Cube> seen = new HashSet<>();
    public static void solve(Cube cube, int vertex) {
        if (vertex == 8) {
            return;
        }
//        if(!seen.contains(cube)) {
            Set<Point> permutations = new HashSet<>();
            getPermute(cube.points[vertex], permutations);
//            if (permutations.size() > 1) {
//                seen.add(cube);
//            }
//            System.out.println(permutations);
            if (cube.isValid()) {
                System.out.println("YES");
                System.out.println(cube);
                done = true;
                return;
            }
            Point before = cube.points[vertex];
            for (Point permutation : permutations) {
                cube.points[vertex] = permutation;
                if (!done) {
                    solve(cube, vertex + 1);
                }
            }
            cube.points[vertex] = before;
//        }
    }

    private static void getPermute(Point point, Set<Point> list) {
        list.add(new Point(point.x, point.y, point.z));
        list.add(new Point(point.x, point.z, point.y));
        list.add(new Point(point.y, point.x, point.z));
        list.add(new Point(point.y, point.z, point.x));
        list.add(new Point(point.z, point.x, point.y));
        list.add(new Point(point.z, point.y, point.x));
    }

    static class Cube {
        Point[] points;
        int index;

        public Cube() {
            points = new Point[8];
            index = 0;
        }

        public void addPoint(Point x) {
            if (index == 8) {
                return;
            }
            points[index++] = x;
        }

        public boolean isValid() {
//            List<Long> dist = new ArrayList<>();
            Map<Long, Integer> count = new HashMap<>();
            for (int i = 0; i < points.length; i++) {
                Point check = points[i];
                for (int j = i + 1; j < points.length; j++) {
//                    System.out.println(check + " " + points[j]);
//                    dist.add(check.dist(points[j]));
                    long dist = check.dist(points[j]);
                    if (dist == 0) {
//                        System.out.println(check + " " + points[j]);
                        return false;
                    }
                    if (count.containsKey(dist)) {
                        int num = count.get(dist) + 1;
                        if (num > 12) {
                            return false;
                        }
                        count.put(dist, num);
                    } else {
                        count.put(dist, 1);
                    }
                    if (count.size() > 3) {
                        return false;
                    }
                }
            }
            // we know that there are 12 side len, 12 side len * sqrt(2), 4 side len * sqrt(3)
            List<Integer> values = new ArrayList<>(count.values());
//            System.out.println(count);
            Collections.sort(values);
            return values.get(0) == 4 && values.get(1) == 12 && values.get(2) == 12;
        }

        private boolean close(double a, double b) {
            return Math.abs(a - b) < .00000003;
        }

        public String toString() {
            StringBuilder out = new StringBuilder();
            for (int i = 0; i < 8; i++) {
                out.append(points[i].toString()).append("\n");
            }
            return out.toString();
        }

        @Override
        public int hashCode() {
            return toString().hashCode();
        }

        @Override
        public boolean equals(Object other) {
            return other instanceof Cube && hashCode() == other.hashCode();
        }
    }

    static class Point {
        int x, y, z;

        public Point(int x, int y, int z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        public long dist(Point other) {
            return (long) (other.x - x) * (other.x - x) + (long) (other.y - y) * (other.y - y) + (long) (other.z - z) * (other.z - z);
        }

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

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

            Point point = (Point) o;

            if (x != point.x) return false;
            if (y != point.y) return false;
            if (z != point.z) return false;

            return true;
        }

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