x,y = map(int,input().split())#map(要转成的函数,被转变量);把list里面每个元素转成整数
print(x and y)
print(x or y)
print(not x)
print(not y)