謝謝你!
while True:
try:
for n in range(int(input())):
a0,b0,c0,d0,e0,f0,g0=map(int,input().split())
a1,b1,c1,d1,e1,f1,g1=map(int,input().split())
x=0
if(b0==d0) or (b0!=f0) or (b1==d1) or (b1!=f1):
print('A', end='')
x=x+1
if(g0==0) or (g1==1):
print('B', end='')
x=x+1
if(b0==b1) or (d0==d1) or (f0==f1):
print('C', end='')
x=x+1
if(x==0):
print('None',end='')
print()
except EOFError:
break