def implication(a, b):
    return not a or b

for x in (0,1):
  for y in (0,1):
    for z in (0,1):
      for w in (0,1):
        f1 = int(implication(w,y) == implication(z,x))
        f2 = int(implication(w,y) and (not x) == z)
        print(x, y, z, w, '|', f1, f2)