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

Fixed submission:
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
X="a"
while True:
    if X == "a":
        if len(A) == 0:
            print("A")
            break
        X = A[0]
        A.pop(0)
    elif X == "b":
        if len(B) == 0:
            print("B")
            break
        X = B[0]
        B.pop(0)
    else:
        if len(C) == 0:
            print("C")
            break
        X = C[0]
        C.pop(0)

Buggy python submission (verdict: Runtime Error):
A=list(input())
B=list(input())
A=list(input())
X=A
while True:
    if X[0] == "a":
        X = A
        X.pop(0)
        if len(X) == 0:
            print("A")
    elif X[0] == "b":
        X = B
        X.pop(0)
        if len(X) == 0:
            print("B")
    else:
        X = C
        X.pop(0)
        if len(X) == 0:
            print("C")

Fixed submission:
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
X="a"
while True:
    if X == "a":
        if len(A) == 0:
            print("A")
            break
        X = A[0]
        A.pop(0)
    elif X == "b":
        if len(B) == 0:
            print("B")
            break
        X = B[0]
        B.pop(0)
    else:
        if len(C) == 0:
            print("C")
            break
        X = C[0]
        C.pop(0)

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

Fixed submission:
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
X="a"
while True:
    if X == "a":
        if len(A) == 0:
            print("A")
            break
        X = A[0]
        A.pop(0)
    elif X == "b":
        if len(B) == 0:
            print("B")
            break
        X = B[0]
        B.pop(0)
    else:
        if len(C) == 0:
            print("C")
            break
        X = C[0]
        C.pop(0)

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

Fixed submission:
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
X="a"
while True:
    if X == "a":
        if len(A) == 0:
            print("A")
            break
        X = A[0]
        A.pop(0)
    elif X == "b":
        if len(B) == 0:
            print("B")
            break
        X = B[0]
        B.pop(0)
    else:
        if len(C) == 0:
            print("C")
            break
        X = C[0]
        C.pop(0)

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

Fixed submission:
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
X="a"
while True:
    if X == "a":
        if len(A) == 0:
            print("A")
            break
        X = A[0]
        A.pop(0)
    elif X == "b":
        if len(B) == 0:
            print("B")
            break
        X = B[0]
        B.pop(0)
    else:
        if len(C) == 0:
            print("C")
            break
        X = C[0]
        C.pop(0)