r=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]
d=[int(x) for x in input().split()]

ans=False
for w in range(1,10):
  x=r[0]-w
  y=c[0]-w
  z=d[0]-w
  if 1<=x<=9 and 1<=y<=9 and 1<=z<=9:
    if w!=x and w!=y and w!=z and x!=y and x!=z and y!=z:
      ans=True
      print(w,x)
      print(y,z)
      break
if not ans:
  print(-1)
