The input consists of four lines, each line containing a single digit 0 or 1.
none
0
1
1
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
1
1
0
0
1
0
0
1
0
0
1
0
1
0
0
1
1
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
1
1
0
1
1
1
0
1
1
1
1
1
a,b,c,d = input()=="1",input()=="1",input()=="1",input()=="1"
x = (b and c)
y = (a or d)
print("1" if ((a or b) and ((a and not b) or (b and not a))) or ((x and not y) or (y and not x)) else "NO")
