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.*;
import java.util.*;
import java.util.List;

public class Main {
    private static StringTokenizer st;
    private static BufferedReader br;
    public static long MOD = 1000000007;

    public static void print(Object x) {
        System.out.println(x + "");
    }
    public static String join(List<?> x, String space) {
        StringBuilder sb = new StringBuilder();
        for (Object elt : x) {
            sb.append(elt);
            sb.append(space);
        }
        return sb.toString();
    }

    public static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine().trim());
        }
        return st.nextToken();
    }
    public static double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public static int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public static List<Double> nextDoubles(int n) throws IOException{
        List<Double> lst = new ArrayList<Double>();
        for (int i = 0; i < n; i++) {
            lst.add(nextDouble());
        }
        return lst;
    }
    public static List<Integer> nextInts(int n) throws IOException{
        List<Integer> lst = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            lst.add(nextInt());
        }
        return lst;
    }
    public static List<Long> nextLongs(int n) throws IOException{
        List<Long> lst = new ArrayList<Long>();
        for (int i = 0; i < n; i++) {
            lst.add(nextLong());
        }
        return lst;
    }
    public static List<Integer> emptyList(int n, int val) {
        List<Integer> lst = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            lst.add(val);
        }
        return lst;
    }
    public static class Two {
        int first;
        int second;
        public Two(int f, int s) {
            first = f;
            second = s;
        }

        @Override
        public int hashCode() {
            return ((Integer) first).hashCode() * 31 + ((Integer) second).hashCode();
        }

        @Override
        public boolean equals(Object obj) {
            if (!(obj instanceof Two)) return false;
            Two o = (Two) obj;
            return (o.first == first) && (o.second == second);
        }
    }

    public static class Pt {
        long x;
        long y;
        long z;
        int id;

        public Pt(long x, long y, long z, int id) {
            this.x = x;
            this.y = y;
            this.z = z;
            this.id = id;
        }

        public Pt(long x, long y, long z) {
            this.x = x;
            this.y = y;
            this.z = z;
            this.id = -1;
        }

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

        @Override
        public boolean equals(Object obj) {
            if (!(obj instanceof Pt)) return false;
            Pt p = (Pt) obj;
            return x == p.x && y == p.y && z == p.z;
        }

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

    public static Pt delta(Pt p1, Pt p2) {
        return new Pt(p2.x - p1.x, p2.y - p1.y, p2.z - p1.z);
    }
    public static Pt add(Pt p1, Pt p2) {
        return new Pt(p2.x + p1.x, p2.y + p1.y, p2.z + p1.z);
    }

    public static long sqDist(Pt d) {
        return d.x*d.x + d.y*d.y + d.z*d.z;
    }

    public static long dot(Pt d1, Pt d2) {
        return d1.x*d2.x + d1.y*d2.y + d1.z*d2.z;
    }

    public static List<List<Pt>> perms(List<Pt> coords) {
        List<List<Pt>> ret = new ArrayList<List<Pt>>();
        if (coords.size() == 0) {
            ret.add(new ArrayList<Pt>());
            return ret;
        }

        int n = coords.size();
        if (n == 8) n = 1;
        n = Math.min(n, 5);
        for (int i = 0; i < n; i++) {
            List<Pt> rest = new ArrayList<Pt>(coords);
            rest.remove(i);
            for (List<Pt> subPerm : perms(rest)) {
                subPerm.add(coords.get(i));
                ret.add(subPerm);
            }
        }
        return ret;
    }

    public static List<Pt> rotations(Pt p) {
        Set<Pt> rots = new HashSet<Pt>();
        rots.add(new Pt(p.x, p.y, p.z, p.id));
        rots.add(new Pt(p.x, p.z, p.y, p.id));
        rots.add(new Pt(p.y, p.x, p.z, p.id));
        rots.add(new Pt(p.y, p.z, p.x, p.id));
        rots.add(new Pt(p.z, p.y, p.x, p.id));
        rots.add(new Pt(p.z, p.x, p.y, p.id));
        return new ArrayList<Pt>(rots);
    }

    public static Pt matchesRot(Pt target, Pt cur) {
        for (Pt rot : rotations(cur)) {
            if (rot.equals(target)) return rot;
        }
        return null;
    }

    public static boolean isCube(List<Pt> coords) {
        for (Pt origin : rotations(coords.get(0))) {
            for (Pt p1 : rotations(coords.get(1))) {
                Pt d1 = delta(origin, p1);
                if (sqDist(d1) == 0) continue;
                for (Pt p2 : rotations(coords.get(2))) {
                    Pt d2 = delta(origin, p2);
                    if (sqDist(d2) == 0) continue;
                    if (sqDist(d1) != sqDist(d2)) continue;
                    if (dot(d1, d2) != 0) continue;
                    for (Pt p3 : rotations(coords.get(3))) {
                        Pt d3 = delta(origin, p3);
                        if (sqDist(d3) == 0) continue;
                        if (sqDist(d1) != sqDist(d3)) continue;
                        if (dot(d1, d3) != 0) continue;
                        if (dot(d2, d3) != 0) continue;

                        Pt s4 = add(p1, d2);
                        s4 = matchesRot(s4, coords.get(4));
                        if (s4 == null) continue;
                        Pt s5 = add(p1, d3);
                        Pt s6 = add(p2, d3);
                        Pt corner = add(s4, d3);
                        s5 = matchesRot(s5, coords.get(5));
                        s6 = matchesRot(s6, coords.get(6));
                        corner = matchesRot(corner, coords.get(7));
                        if (s5 == null) continue;
                        if (s6 == null) continue;
                        if (corner == null) continue;

                        print("YES");
                        Pt[] original = new Pt[8];
                        original[origin.id] = origin;
                        original[p1.id] = p1;
                        original[p2.id] = p2;
                        original[p3.id] = p3;
                        original[s4.id] = s4;
                        original[s5.id] = s5;
                        original[s6.id] = s6;
                        original[corner.id] = corner;
                        for (int i = 0; i < 8; i++) {
                            print(original[i]);
                        }
                        return true;
                    }
                }
            }
        }
        return false;
    }

    public static String solve(List<Pt> coords) {
        for (List<Pt> coordPerm : perms(coords)) {
            if (isCube(coordPerm)) {
                return "";
            }
        }
        return "NO";
    }

    public static void main(String[] args) throws Exception {
        boolean debug = false;
        InputStream in = System.in;
        if (debug) {
            in = new FileInputStream("input.in");
        }
        br = new BufferedReader(new InputStreamReader(in));

        List<Pt> coords = new ArrayList<Pt>();
        for (int i = 0; i < 8; i++) {
            coords.add(new Pt(nextInt(), nextInt(), nextInt(), i));
        }
        //print(perms(coords.subList(0, 4)));
        print(solve(coords));
    }
}