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:
//package codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class D {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter writer = new PrintWriter(System.out);
    StringTokenizer stringTokenizer;

    String next() throws IOException {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            stringTokenizer = new StringTokenizer(reader.readLine());
        }
        return stringTokenizer.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    final int MOD = 1000 * 1000 * 1000 + 7;
    int sum(int a, int b) {
        a += b;
        return a >= MOD ? a - MOD : a;
    }

    @SuppressWarnings("unchecked")
    void solve() throws IOException {
        class Point {
            int[] coords;

            Point(int[] coords) {
                this.coords = coords;
            }

            Point() {
                this.coords = new int[3];
            }

            long scalarProduct(Point p) {
                long result = 0;
                for(int i = 0; i < coords.length; i++) {
                    result += 1l * coords[i] * p.coords[i];
                }
                return result;
            }

            long length() {
                return scalarProduct(this);
            }

            boolean equalsTo(Point p) {
                for(int i = 0; i < coords.length; i++) {
                    if(p.coords[i] != coords[i]) {
                        return false;
                    }
                }
                return true;
            }
        }
        class Utils {
            Point[] readAndPermute() throws IOException {
                int[] x = new int[3];
                for(int i = 0; i < 3; i++) {
                    x[i] = nextInt();
                }
                return new PointGenerator(x).generate();
            }

            class PointGenerator {
                Point[] p = new Point[6];
                int pos = 0;
                int[] input;
                int[] x;

                PointGenerator(int[] input) {
                    this.input = input;
                    x = new int[input.length];
                }

                void generate(int k, int used) {
                    if(k == 3) {
                        p[pos++] = new Point(Arrays.copyOf(x, x.length));
                        return;
                    }
                    for(int i = 0; i < x.length; i++) {
                        if(((1 << i) & used) == 0) {
                            x[k] = input[i];
                            generate(k + 1, used | (1 << i));
                        }
                    }
                }

                Point[] generate() {
                    generate(0, 0);
                    return p;
                }
            }

            Point[] pickPoints(Point[][] points) {
                return pickPoints(points, 0, new Point[8]);
            }

            Point[] v = new Point[8];
            {
                for(int i = 0; i < v.length; i++) {
                    v[i] = new Point();
                }
            }
            long[] d = new long[8];
            Point[] basis = new Point[3];
            Point tmp = new Point();

            boolean find(Point[] where, Point what) {
                for (Point point : where) {
                    if(what.equalsTo(point)) {
                        return true;
                    }
                }
                return false;
            }

            Point[] pickPoints(Point[][] points, int k, Point[] selection) {
                if(k == 8) {
                    //check
                    long minD = Long.MAX_VALUE;
                    for(int i = 1; i < 8; i++) {
                        for(int j = 0; j < v[i].coords.length; j++) {
                            v[i].coords[j] = selection[i].coords[j] - selection[0].coords[j];
                        }
                        d[i] = v[i].length();
                        minD = Math.min(minD, d[i]);
                    }
                    if(minD == 0) {
                        return null;
                    }
                    int bCount = 0;
                    for(int i = 1; bCount < 3 && i < 8; i++) {
                        if(d[i] == minD) {
                            basis[bCount++] = v[i];
                        }
                    }
                    if(bCount < 3) {
                        return null;
                    }
                    Point o = selection[0];
                    for(int i = 0; i < 3; i++) {
                        if(basis[i].scalarProduct(basis[(i + 1) % 3]) != 0) {
                            return null;
                        }
                    }
                    for(int i = 0; i < 3; i++) {
                        for(int j = 0; j < 3; j++) {
                            tmp.coords[j] = o.coords[j] + basis[i].coords[j] + basis[(i + 1) % 3].coords[j];
                        }
                        if(!find(selection, tmp)) {
                            return null;
                        }
                    }
                    for(int j = 0; j < 3; j++) {
                        tmp.coords[j] += basis[1].coords[j];
                    }
                    return find(selection, tmp) ? selection : null;
                } else {
                    for (Point point : points[k]) {
                        selection[k] = point;
                        final Point[] picked = pickPoints(points, k + 1, selection);
                        if(picked != null) {
                            return picked;
                        }
                    }
                    return null;
                }
            }
        }
        Utils utils = new Utils();
        Point[][] points = new Point[8][];
        for(int i = 0; i < 8; i++) {
            points[i] = utils.readAndPermute();
        }
        final Point[] selection = utils.pickPoints(points);
        if(selection == null) {
            writer.println("NO");
        } else {
            writer.println("YES");
            for (Point point : selection) {
                for (int coord : point.coords) {
                    writer.print(coord + " ");
                }
                writer.println();
            }
        }
        writer.close();
    }

    public static void main(String[] args) throws IOException {
        new D().solve();
    }
}