Buggy python submission (verdict: Runtime Error):
a=list(input())
b=list(input())
c=list(input())
next=a[0]
del a[0]
while True:
    if len(a)==0 and next=="a":
        print("A")
        break
    if len(b)==0 and next=="b":
        print("B")
        break
    if len(c)==0 and next=="c":
        print("C")
        break
    if next=="a":
        next=a[0]
        del a[0]
    if next=="b":
        next=b[0]
        del b[0]
    if next=="c":
        next=c[0]
        del c[0]


Fixed submission:
sa=list(input())
sb=list(input())
sc=list(input())
owner="a"
while True:
    if owner=="a":
        if len(sa):
            owner=sa[0]
            del sa[0]
        else:
            break
    elif owner=="b":
        if len(sb):
            owner=sb[0]
            del sb[0]
        else:
            break
    else:
        if len(sc):
            owner=sc[0]
            del sc[0]
        else:
            break
if owner=="a":
    print("A")
elif owner=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
a=list(input())
b=list(input())
c=list(input())
next=a[0]
del a[0]
while True:
    if next=="a":
        next=a[0]
        del a[0]
    if next=="b":
        next=b[0]
        del b[0]
    if next=="c":
        next=c[0]
        del c[0]
    if len(a)==0 and next=="a":
        print("A")
        break
    if len(b)==0 and next=="b":
        print("B")
        break
    if len(c)==0 and next=="c":
        print("C")
        break

Fixed submission:
sa=list(input())
sb=list(input())
sc=list(input())
owner="a"
while True:
    if owner=="a":
        if len(sa):
            owner=sa[0]
            del sa[0]
        else:
            break
    elif owner=="b":
        if len(sb):
            owner=sb[0]
            del sb[0]
        else:
            break
    else:
        if len(sc):
            owner=sc[0]
            del sc[0]
        else:
            break
if owner=="a":
    print("A")
elif owner=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
a=list(input())
b=list(input())
c=list(input())
next=a[0]
del a[0]
while True:
    if next=="a":
        next=a[0]
        del a[0]
    if next=="b":
        next=b[0]
        del b[0]
    if next=="c":
        next=c[0]
        del c[0]
    if len(a)==0 and next=="a":
        print("A")
        break
    if len(b)==0 and next=="b":
        print("B")
        break
    if len(c)==0 and next=="c":
        print("C")
        break

Fixed submission:
sa=list(input())
sb=list(input())
sc=list(input())
owner="a"
while True:
    if owner=="a":
        if len(sa):
            owner=sa[0]
            del sa[0]
        else:
            break
    elif owner=="b":
        if len(sb):
            owner=sb[0]
            del sb[0]
        else:
            break
    else:
        if len(sc):
            owner=sc[0]
            del sc[0]
        else:
            break
if owner=="a":
    print("A")
elif owner=="b":
    print("B")
else:
    print("C")

Buggy python submission (verdict: Runtime Error):
sa=list(input())
sb=list(input())
sc=list(input())
owner="a"
while True:
    if owner=="a":
        if len(A):
            owner=A[0]
            del A[0]
        else:
            break
    elif owner=="b":
        if len(B):
            owner=B[0]
            del B[0]
        else:
            break
    else:
        if len(C):
            owner=C[0]
            del C[0]
        else:
            break
if owner=="a":
    print("A")
elif owner=="b":
    print("B")
else:
    print("C")

Fixed submission:
sa=list(input())
sb=list(input())
sc=list(input())
owner="a"
while True:
    if owner=="a":
        if len(sa):
            owner=sa[0]
            del sa[0]
        else:
            break
    elif owner=="b":
        if len(sb):
            owner=sb[0]
            del sb[0]
        else:
            break
    else:
        if len(sc):
            owner=sc[0]
            del sc[0]
        else:
            break
if owner=="a":
    print("A")
elif owner=="b":
    print("B")
else:
    print("C")