Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
stuck = ["" for i in range(n)]
while True:
    a = raw_input().split()
    if a[0] == "quit":
        break
    if a[0] == "push":
        stuck[a[1]] += a[2]
    elif a[0] == "pop":
        l = len(stuck[a[1]]) - 1
        print stuck[a[1]][l]
        stuck[a[1]] = stuck[a[1]][:l]
    elif a[0] == "move"
        l = len(stuck[a[1]]) - 1
        stuck[a[2]] += stuck[a[1]][l]
        stuck[a[1]] = stuck[a[1]][:l]

Fixed submission:
n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit":
        break

    i = int(a[1]) - 1
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2]) - 1 
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
stuck = ["" for i in range(n)]
while True:
    a = raw_input().split()
    if a[0] == "quit":
        break
    if a[0] == "push":
        stuck[a[1]] += a[2]
    elif a[0] == "pop":
        l = len(stuck[a[1]]) - 1
        print stuck[a[1]][l]
        stuck[a[1]] = stuck[a[1]][:l]
    elif a[0] == "move":
        l = len(stuck[a[1]]) - 1
        stuck[a[2]] += stuck[a[1]][l]
        stuck[a[1]] = stuck[a[1]][:l]

Fixed submission:
n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit":
        break

    i = int(a[1]) - 1
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2]) - 1 
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
s = ["" for i in range(n)]
while True:
    a = raw_input().split()
    if a[0] == "quit":
        break
    if a[0] == "push":
        s[int(a[1])] += a[2]
    elif a[0] == "pop":
        l = len(s[int(a[1])]) - 1
        print s[int(a[1])][l]
        s[int(a[1)]] = s[int(a[1])][:l]
    elif a[0] == "move":
        l = len(s[int(a[1])]) - 1
        stuck[int(a[2])] += stuck[int(a[1])][l]
        stuck[int(a[1])] = stuck[int(a[1])][:l]

Fixed submission:
n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit":
        break

    i = int(a[1]) - 1
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2]) - 1 
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
s = ["" for i in range(n)]
while True:
    a = raw_input().split()
    if a[0] == "quit":
        break
    if a[0] == "push":
        s[int(a[1])] += a[2]
    elif a[0] == "pop":
        l = len(s[int(a[1])]) - 1
        print s[int(a[1])][l]
        s[int(a[1)]] = s[int(a[1])][:l]
    elif a[0] == "move":
        l = len(s[int(a[1])]) - 1
        s[int(a[2])] += s[int(a[1])][l]
        s[int(a[1])] = s[int(a[1])][:l]

Fixed submission:
n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit":
        break

    i = int(a[1]) - 1
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2]) - 1 
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit":
        break

    i = int(a[1])
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2])
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]

Fixed submission:
n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit":
        break

    i = int(a[1]) - 1
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2]) - 1 
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit"
        break

    i = int(a[1]) - 1
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2]) - 1 
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]

Fixed submission:
n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit":
        break

    i = int(a[1]) - 1
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2]) - 1 
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]