Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(a)==0:
    print("A")
elif len(b)==0:
    print("B")
else:
    print("C")


Fixed submission:
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
C=input()
s="a"
while (len(a)!=0 or s!="a") and (len(b)!=0 or s!="b") and (len(c)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(a)==0:
    print("A")
elif len(b)==0:
    print("B")
else:
    print("C")


Fixed submission:
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
C=input()
s="a"
while (len(a)!=0 or s!="a") and (len(b)!=0 or s!="b") and (len(c)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(s1)==0:
    print("A")
elif len(s2)==0:
    print("B")
else:
    print("C")


Fixed submission:
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
C=input()
s="a"
while true:
  print(str(len(A))+str(len(B))+str(len(C)))
  if s=="a":
    s=A[0]
    A=A[1:]
    if len(A)==0:
        print("A")
        break
  elif s=="b":
    s=B[0]
    B=B[1:]
    if len(B)==0:
        print("B")
        break
  else:
    s=C[0]
    C=C[1:]
    if len(C)==0:
        print("C")
        break


Fixed submission:
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
C=input()
s="a"
while:
  print(str(len(A))+str(len(B))+str(len(C)))
  if s=="a":
    s=A[0]
    A=A[1:]
    if len(A)==0:
        print("A")
        break
  elif s=="b":
    s=B[0]
    B=B[1:]
    if len(B)==0:
        print("B")
        break
  else:
    s=C[0]
    C=C[1:]
    if len(C)==0:
        print("C")
        break


Fixed submission:
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Time Limit Exceeded):
A=input()
B=input()
C=input()
s="a"
while len(A)!=0 and len(B)!=0 and len(C)!=0:
  if s=="a":
    if A[0]=="b":
      s="b"
      continue
    if A[0]=="c":
      s="c"
      continue
  elif s=="b":
    if B[0]=="c":
      s="c"
      continue
    if B[0]=="a":
      s="a"
      continue
  else:
    if C[0]=="a":
      s="a"
      continue
    if C[0]=="b":
      s="b"
      continue
if len(A)==0:
  print("A")
elif len(B)==0:
  print("B")
else:
  print("C")

Fixed submission:
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
C=input()
s=a
while len(A)!=0 and len(B)!=0 and len(C)!=0:
  if s=="a":
    if A[0]=="b":
      s="b"
      continue
    if A[0]=="c":
      s="c"
      continue
  elif s=="b":
    if B[0]=="c":
      s="c"
      continue
    if B[0]=="a":
      s="a"
      continue
  else:
    if C[0]=="a":
      s="a"
      continue
    if C[0]=="b":
      s="b"
      continue
if len(A)==0:
  print("A")
elif len(B)==0:
  print("B")
else:
  print("C")

Fixed submission:
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
C=input()
s=a
while len(A)!=0 and len(B)!=0 and len(C)!=0:
  if s==a:
    if A[0]==b:
      s=b
      continue
    if A[0]==c:
      s=c
      continue
  elif s==b:
    if B[0]==c:
      s=c
      continue
    if B[0]==a:
      s=a
      continue
  else:
    if C[0]==a:
      s=a
      continue
    if C[0]==b:
      s=b
      continue
if len(A)==0:
  print("A")
elif len(B)==0:
  print("B")
else:
  print("C")
    
  

Fixed submission:
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")