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 PYTHON):

Solution:
import sys

sys.setrecursionlimit(10 ** 6)

def pyes_no(condition) :
  if condition :
    print ("YES")
  else :
    print ("NO")

def plist(a, s = ' ') :
  print (s.join(map(str, a)))

def rint() :
  return int(sys.stdin.readline())

def rints() :
  return map(int, sys.stdin.readline().split())

def rfield(n, m = None) :
  if m == None :
    m = n
  
  field = []
  for i in xrange(n) :
    chars = sys.stdin.readline().strip()
    assert(len(chars) == m)
    field.append(chars)
  return field

def pfield(field, separator = '') :
  print ('\n'.join(map(lambda x: separator.join(x), field)))

def check_field_equal(field, i, j, value) :
  if i >= 0 and i < len(field) and j >= 0 and j < len(field[i]) :
    return value == field[i][j]
  return None 

def digits(x, p) :
  digits = []
  while x > 0 :
    digits.append(x % p)
    x //= p
  return digits

def modpower(a, n, mod) :
  r = a ** (n % 2)
  if n > 1 :
    r *= modpower(a, n // 2, mod) ** 2
  return r % mod

def gcd(a, b) :
  if a > b :
    a, b = b, a
  
  while a > 0 :
    a, b = b % a, a

  return b

def vector_distance(a, b) :
  diff = vector_diff(a, b)
  
  return scalar_product(diff, diff) ** 0.5

def vector_inverse(v) :
  r = [-x for x in v]

  return tuple(r)

def vector_diff(a, b) :
  return vector_sum(a, vector_inverse(b))

def vector_sum(a, b) :
  r = [c1 + c2 for c1, c2 in zip(a, b)]
    
  return tuple(r)

def scalar_product(a, b) :
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]

def check_rectangle(points) :
  assert(len(points) == 4)

  A, B, C, D = points

  for A1, A2, A3, A4 in [
    (A, B, C, D),
    (A, C, B, D),
    (A, B, D, C),
    (A, C, D, B),
    (A, D, B, C),
    (A, D, C, B),
  ] :
    sides = (
      vector_diff(A1, A2),
      vector_diff(A2, A3),
      vector_diff(A3, A4),
      vector_diff(A4, A1),
    )
    if all(scalar_product(s1, s2) == 0 for s1, s2 in zip(sides, sides[1:])) :
       return True
  return False

def check_square(points) :
  if not check_rectangle(points) :
    return False
  A, B, C, D = points

  for A1, A2, A3, A4 in [
    (A, B, C, D),
    (A, C, B, D),
    (A, B, D, C),
    (A, C, D, B),
    (A, D, B, C),
    (A, D, C, B),
  ] :
    side_lengths = [
      (first[0] - next[0]) ** 2 + (first[1] - next[1]) ** 2 for first, next in zip([A1, A2, A3, A4], [A2, A3, A4, A1])
    ]
    if len(set(side_lengths)) == 1 :
      return True
    
  return False

def check_right(p) :
  # Check if there are same points
  for a, b in [
    (p[0], p[1]),
    (p[0], p[2]),
    (p[1], p[2]),
  ] :
    if a[0] == b[0] and a[1] == b[1] :
      return False

  a, b, c = p
  a, b, c = vector_diff(a, b), vector_diff(b, c), vector_diff(c, a)   

  return scalar_product(a, b) * scalar_product(a, c) * scalar_product(b, c) == 0

points = []

for i in range(8) :
  points.append(rints())

x0, y0, z0 = points[0]

from itertools import permutations, combinations
def unique_permutations(a) :
  return set(permutations(a))

sides = []

cube_scalars = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2]

def check_cube(sides) :
  sides_r = [a[0] * a[0] + a[1] * a[1] + a[2] * a[2] for a in sides]
  r2 = min(sides_r)

  if (r2 == 0 
    or not all([v % r2 == 0 for v in sides_r]) 
    or sorted(sides_r) != [r2, r2, r2, 2 * r2, 2 * r2, 2 * r2, 3 * r2]
  ) :
    return False

  products = [a[0] * b[0] + a[1] * b[1] + a[2] * b[2] for a, b in combinations(sides, 2)]
  
  if not all([v % r2 == 0 for v in products]) :
    return False
  
  products = sorted([v / r2 for v in products])
  # print products
  # print cube_scalars
  # print '---' 
  return products == cube_scalars
 

for x1, y1, z1 in unique_permutations(points[1]) :
  x1 -= x0
  y1 -= y0
  z1 -= z0
  sides.append((x1, y1, z1))
  for x2, y2, z2 in unique_permutations(points[2]) :
    x2 -= x0
    y2 -= y0
    z2 -= z0
    sides.append((x2, y2, z2))
    for x3, y3, z3 in unique_permutations(points[3]) :
      x3 -= x0
      y3 -= y0
      z3 -= z0
      sides.append((x3, y3, z3))
      for x4, y4, z4 in unique_permutations(points[4]) :
        x4 -= x0
        y4 -= y0
        z4 -= z0
        sides.append((x4, y4, z4))
        for x5, y5, z5 in unique_permutations(points[5]) :
          x5 -= x0
          y5 -= y0
          z5 -= z0
          sides.append((x5, y5, z5))
          for x6, y6, z6 in unique_permutations(points[6]) :
            x6 -= x0
            y6 -= y0
            z6 -= z0
            sides.append((x6, y6, z6))
            for x7, y7, z7 in unique_permutations(points[7]) :
              x7 -= x0
              y7 -= y0
              z7 -= z0
              sides.append((x7, y7, z7))
              if check_cube(sides) :
                print "YES"
                print x0, y0, z0
                for x, y, z in sides :
                  print x + x0, y + y0, z + z0
                exit(0)
              sides.pop()
            sides.pop()
          sides.pop()
        sides.pop()
      sides.pop()
    sides.pop()
  sides.pop()
              
print "NO"