Buggy python submission (verdict: Runtime Error):
N = int(input())
s = []
for i in range(N):
    val = sorted(input())
    s.append(val)

an = 0
for i in range(N):
    if len(s[an]) <= len(s[i]):
        continue
    else:
        an = i

a = s[an]
n = 0

for i in range(N):
    n = 0
    while len(s[i]) > len(a) and n < len(a):
        if a[n] == s[i][n]:
            n += 1
        else:
            if n == 0:
                a.pop(0)
                s[i].pop(0)
            else:
                if ord(a[n]) > ord(s[i][n]):
                    s[i].pop(n)
                else:
                    a.pop(n)
    if a[n-1] == s[i][n-1]:
        continue
    else:
        a.pop(-1)

print(''.join(a))


Fixed submission:
N = int(input())
s = []
for i in range(N):
    val = sorted(input())
    s.append(val)

an = 0
for i in range(N):
    if len(s[an]) <= len(s[i]):
        continue
    else:
        an = i

a = s[an]

for i in range(N):
    n = 0
    while a != s[i] and n < len(a) and n < len(s[i]):
        if a[n] == s[i][n]:
            n += 1
        else:
            if a[n] > s[i][n]:
                s[i].pop(n)
            else:
                a.pop(n)
    if len(a) > len(s[i]):
        a = s[i]

print(''.join(a))

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = []
for i in range(N):
    val = sorted(input())
    s.append(val)

an = 0
for i in range(N):
    if len(s[an]) <= len(s[i]):
        continue
    else:
        an = i

a = s[an]
n = 0

for i in range(N):
    n = 0
    while len(s[i]) > len(a) and n < len(a):
        if a[n] == s[i][n]:
            n += 1
        else:
            if n == 0:
                a.pop(0)
                s[i].pop(n)
            else:
                if ord(a[n]) > ord(s[i][n]):
                    s[i].pop(n)
                else:
                    a.pop(n)
    if a[n-1] == s[i][n-1]:
        continue
    else:
        a.pop(-1)

print(''.join(a))


Fixed submission:
N = int(input())
s = []
for i in range(N):
    val = sorted(input())
    s.append(val)

an = 0
for i in range(N):
    if len(s[an]) <= len(s[i]):
        continue
    else:
        an = i

a = s[an]

for i in range(N):
    n = 0
    while a != s[i] and n < len(a) and n < len(s[i]):
        if a[n] == s[i][n]:
            n += 1
        else:
            if a[n] > s[i][n]:
                s[i].pop(n)
            else:
                a.pop(n)
    if len(a) > len(s[i]):
        a = s[i]

print(''.join(a))

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = []
for i in range(N):
    val = sorted(input())
    s.append(val)

an = 0
for i in range(N):
    if len(s[an]) <= len(s[i]):
        continue
    else:
        an = i

a = s[an]
n = 0

for i in range(N):
    n = 0
    while len(s[i]) > len(a) and n < len(a):
        if a[n] == s[i][n]:
            n += 1
        else:
            if ord(a[n]) > ord(s[i][n]):
                s[i].pop(n)
                n -= 1
            else:
                a.pop(n)
                n -= 1
    if a[n-1] == s[i][n-1]:
        continue
    else:
        a.pop(-1)

print(''.join(a))


Fixed submission:
N = int(input())
s = []
for i in range(N):
    val = sorted(input())
    s.append(val)

an = 0
for i in range(N):
    if len(s[an]) <= len(s[i]):
        continue
    else:
        an = i

a = s[an]

for i in range(N):
    n = 0
    while a != s[i] and n < len(a) and n < len(s[i]):
        if a[n] == s[i][n]:
            n += 1
        else:
            if a[n] > s[i][n]:
                s[i].pop(n)
            else:
                a.pop(n)
    if len(a) > len(s[i]):
        a = s[i]

print(''.join(a))