x,y = input().split()
print(int(x)&int(y))
print(int(x)|int(y))