#字面简单解法
x,y = input().split()
print(x and y) #与
print(x or y)#或
print(not int(x)) #非,float
print(not int(y))#非,float