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

public class Main {
  private static Reader in;
  private static PrintWriter out;

  public static void main(String[] args) throws IOException {
    in = new Reader();
    out = new PrintWriter(System.out, true);
    coords = new long[8][3];
    for (int i = 0; i < 8; i++)
      for (int j = 0; j < 3; j++)
        coords[i][j] = in.nextInt();
    check = new long[8][3];
    dfs(0);
    
    out.println("NO");
    out.close();
    System.exit(0);
  }
  
  public static long[][] check, coords;
  
  public static long sq(long x){return x * x;}
  
  public static boolean isCube() {
    long v1 = -1, v2 = -1, v3 = -1;
    int c1 = 0, c2 = 0, c3 = 0;
    for (int i = 0; i < 8; i++) {
      for (int j = i + 1; j < 8; j++) {
        long key = sq(check[i][0] - check[j][0]) +
                   sq(check[i][1] - check[j][1]) +
                   sq(check[i][2] - check[j][2]);
        if (key == v1) c1++;
        else if (key == v2) c2++;
        else if (key == v3) c3++;
        else if (v1 == -1) {
          v1 = key;
          c1++;
        } else if (v2 == -1) {
          v2 = key;
          c2++;
        } else if (v3 == -1) {
          v3 = key;
          c3++;
        } else return false;
      }
    }
    int[] counts = new int[30];
    counts[c1]++; counts[c2]++; counts[c3]++;
    if (counts[4] != 1 || counts[12] != 2)
      return false;
    return true;
  }
  
  public static void dfs(int index) {
    if (index == 8) {
      if(isCube()) {
        out.println ("YES");
        for (int i = 0; i < 8; i++) {
          out.printf("%d %d %d\n", check[i][0], check[i][1], check[i][2]);
        }
        out.close();
        System.exit(0);
      }
      return;
    }
    
    check[index][0] = coords[index][0];
    check[index][1] = coords[index][1];
    check[index][2] = coords[index][2];
    dfs(index + 1);
    check[index][0] = coords[index][0];
    check[index][1] = coords[index][2];
    check[index][2] = coords[index][1];
    dfs(index + 1);
    check[index][0] = coords[index][1];
    check[index][1] = coords[index][0];
    check[index][2] = coords[index][2];
    dfs(index + 1);
    check[index][0] = coords[index][1];
    check[index][1] = coords[index][2];
    check[index][2] = coords[index][0];
    dfs(index + 1);
    check[index][0] = coords[index][2];
    check[index][1] = coords[index][0];
    check[index][2] = coords[index][1];
    dfs(index + 1);
    check[index][0] = coords[index][2];
    check[index][1] = coords[index][1];
    check[index][2] = coords[index][0];
    dfs(index + 1);
  }

  static class Reader {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader() {
      din = new DataInputStream(System.in);
      buffer = new byte[BUFFER_SIZE];
      bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException {
      din = new DataInputStream(new FileInputStream(file_name));
      buffer = new byte[BUFFER_SIZE];
      bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException {
      byte[] buf = new byte[1024];
      int cnt = 0, c;
      while ((c = read()) != -1) {
        if (c == '\n')
          break;
        buf[cnt++] = (byte) c;
      }
      return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException {
      int ret = 0;
      byte c = read();
      while (c <= ' ')
        c = read();
      boolean neg = (c == '-');
      if (neg)
        c = read();
      do {
        ret = ret * 10 + c - '0';
      } while ((c = read()) >= '0' && c <= '9');
      if (neg)
        return -ret;
      return ret;
    }

    public long nextLong() throws IOException {
      long ret = 0;
      byte c = read();
      while (c <= ' ')
        c = read();
      boolean neg = (c == '-');
      if (neg)
        c = read();
      do {
        ret = ret * 10 + c - '0';
      } while ((c = read()) >= '0' && c <= '9');
      if (neg)
        return -ret;
      return ret;
    }

    public double nextDouble() throws IOException {
      double ret = 0, div = 1;
      byte c = read();
      while (c <= ' ')
        c = read();
      boolean neg = (c == '-');
      if (neg)
        c = read();
      do {
        ret = ret * 10 + c - '0';
      } while ((c = read()) >= '0' && c <= '9');
      if (c == '.')
        while ((c = read()) >= '0' && c <= '9')
          ret += (c - '0') / (div *= 10);
      if (neg)
        return -ret;
      return ret;
    }

    private void fillBuffer() throws IOException {
      bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
      if (bytesRead == -1)
        buffer[0] = -1;
    }

    private byte read() throws IOException {
      if (bufferPointer == bytesRead)
        fillBuffer();
      return buffer[bufferPointer++];
    }

    public void close() throws IOException {
      if (din == null)
        return;
      din.close();
    }
  }

}