Buggy python submission (verdict: Time Limit Exceeded):
a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        if len(a_list)==0:
            print("A")
            break
        else:
            x = a_list.pop(0)
    elif x == "b":
        if len(b_list)==0:
            print("B")
            break
        else:
            x = b_list.pop(0)
    else:
        if len(c_list)==0:
            print("C")
        else:
            x = c_list.pop(0)
    

Fixed submission:
a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        if len(a_list)==0:
            print("A")
            break
        else:
            x = a_list.pop(0)
    elif x == "b":
        if len(b_list)==0:
            print("B")
            break
        else:
            x = b_list.pop(0)
    else:
        if len(c_list)==0:
            print("C")
            break
        else:
            x = c_list.pop(0)

Buggy python submission (verdict: Runtime Error):
a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        x = a_list.pop(0)
    elif x == "b":
        x = b_list.pop(0)
    else:
        x = c_list.pop(0)
    if not len(a_list):
        print("A")
        break
    elif not len(b_list):
        print("B")
        break
    elif not len(c_list):
        print("C")
        break

Fixed submission:
a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        if len(a_list)==0:
            print("A")
            break
        else:
            x = a_list.pop(0)
    elif x == "b":
        if len(b_list)==0:
            print("B")
            break
        else:
            x = b_list.pop(0)
    else:
        if len(c_list)==0:
            print("C")
            break
        else:
            x = c_list.pop(0)

Buggy python submission (verdict: Runtime Error):
a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        x = a_list.pop(0)
    elif x == "b":
        x = b_list.pop(0)
    else:
        x = c_list.pop(0)
    if len(a_list)==0:
        print("A")
        break
    elif len(b_list)==0:
        print("B")
        break
    elif len(c_list):
        print("C")
        break

Fixed submission:
a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        if len(a_list)==0:
            print("A")
            break
        else:
            x = a_list.pop(0)
    elif x == "b":
        if len(b_list)==0:
            print("B")
            break
        else:
            x = b_list.pop(0)
    else:
        if len(c_list)==0:
            print("C")
            break
        else:
            x = c_list.pop(0)

Buggy python submission (verdict: Runtime Error):
a_list = list(input())
#print(a_list)
b_list = list(input())
#print(b_list)
c_list = list(input())
#print(c_list)
x=a_list.pop(0)
while True:
    if x=="a":
        x = a_list.pop(0)
    elif x == "b":
        x = b_list.pop(0)
    else:
        x = c_list.pop(0)
    if len(a_list)==0:
        print("A")
        break
    elif len(b_list)==0:
        print("B")
        break
    elif len(c_list):
        print("C")
        break

Fixed submission:
a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        if len(a_list)==0:
            print("A")
            break
        else:
            x = a_list.pop(0)
    elif x == "b":
        if len(b_list)==0:
            print("B")
            break
        else:
            x = b_list.pop(0)
    else:
        if len(c_list)==0:
            print("C")
            break
        else:
            x = c_list.pop(0)