_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))
n=eval([*open(0)][1].replace(*' |'))

print((len(bin(n&-n))-3))
_, t = open(0)
n = eval(t.replace(" ", "|"))
print((len(bin(n & -n)) - 3))

n = eval([*open(0)][1].replace(*" |"))
print((len(bin(n & -n)) - 3))

-_, t = open(0) -n = eval(t.replace(" ", "|")) +n = eval([*open(0)][1].replace(*" |"))