Buggy python submission (verdict: Runtime Error):
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  now = next
  if counts[now] == lens[now]:
    print(now)
    exit()
  counts[now] += 1
  next = S[now][counts[now]]


Fixed submission:
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  now = next
  counts[now]
  if counts[now] == lens[now]:
    print(now.upper())
    exit()
  next = S[now][counts[now]]
  counts[now] += 1

Buggy python submission (verdict: Runtime Error):
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  now = next
  if counts[now] == len[now]:
    print(now)
    exit()
  next = S[now][counts[now]]
  counts[now] += 1


Fixed submission:
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  now = next
  counts[now]
  if counts[now] == lens[now]:
    print(now.upper())
    exit()
  next = S[now][counts[now]]
  counts[now] += 1

Buggy python submission (verdict: Runtime Error):
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  if counts[next] == len[next]:
    print(next)
    exit()
  next = S[next][counts[next]]
  counts[next] += 1


Fixed submission:
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  now = next
  counts[now]
  if counts[now] == lens[now]:
    print(now.upper())
    exit()
  next = S[now][counts[now]]
  counts[now] += 1

Buggy python submission (verdict: Runtime Error):
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S[0]), 'b':len(S[1]), 'c':len(S[2])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  if counts[next] == len[next]:
    print(next)
    exit()
  next = S[next][counts[next]]
  counts[next] += 1


Fixed submission:
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  now = next
  counts[now]
  if counts[now] == lens[now]:
    print(now.upper())
    exit()
  next = S[now][counts[now]]
  counts[now] += 1

Buggy python submission (verdict: Runtime Error):
S = [input() for _ in range(3)]

next = 0
lens = [len(i) for i in S]
counts = [0]*3

while True:
  if counts[next] == len[next]:
    if next == 0:
      print('a')
    elif next == 1:
      print('b')
    else:
      print('c')
    exit()
  next = S[next][counts[next]]
  counts[next] += 1

Fixed submission:
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  now = next
  counts[now]
  if counts[now] == lens[now]:
    print(now.upper())
    exit()
  next = S[now][counts[now]]
  counts[now] += 1