Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1
while d==1:
    if t=='a':
        t=A.pop(0)
    if t=='b':
        t=B.pop(0)
    if t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    if t=='b' and B==[]:
        print('B')
        break
    if t=='c' and C==[]:
        print('C')
        break

Fixed submission:
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1#ずっとまわすつもり。
while d==1:
    if t=='a':
        t=A.pop(0)
    elif t=='b':
        t=B.pop(0)
    elif t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1
while d==1:
    if t=='a':
        t=A.pop(0)
    if t=='b':
        t=B.pop(0)
    if t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break

Fixed submission:
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1#ずっとまわすつもり。
while d==1:
    if t=='a':
        t=A.pop(0)
    elif t=='b':
        t=B.pop(0)
    elif t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break

Buggy python submission (verdict: Runtime Error):
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1
while d==1:
    if t=='a':
        t=A.pop(0)
    if t=='b':
        t=B.pop(0)
    if t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break

Fixed submission:
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1#ずっとまわすつもり。
while d==1:
    if t=='a':
        t=A.pop(0)
    elif t=='b':
        t=B.pop(0)
    elif t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break

Buggy python submission (verdict: Runtime Error):
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1
while d==1:
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break
    if t=='a':
        t=A.pop(0)
    if t=='b':
        t=B.pop(0)
    if t=='c':
        t=C.pop(0)

Fixed submission:
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1#ずっとまわすつもり。
while d==1:
    if t=='a':
        t=A.pop(0)
    elif t=='b':
        t=B.pop(0)
    elif t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break