Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
import itertools
from collections import deque
ans = deque()
l = []
r = deque()
for i in range(N):
  l.append(chr(97+i))
  r.append(l.copy())
  
p = [[] for _ in range(N)]
p[0].append('a')
for i in range(1,N):
  for j in r[i]:
    for k in p[i-1]:
      p[i].append(k+j)
      
p = p[-1]
for i in p:
  a = [0]*10
  for j in i:
    x = ord(j)-97
    a[x]=1
    if x==0:
      judge = True
      continue
    elif a[x-1]==1:
      judge = True
      continue
    else:
      judge = False
      break
  if judge:
    ans.append(i)
ans = set(ans)
ans = sorted(list(ans))
for a in ans:
  print(a)

Fixed submission:
N = int(input())
from collections import deque
import itertools
ans = deque()
l = []
r = deque()
for i in range(N):
  l.append(chr(97+i))
  r.append(l.copy())
  

p = [[[] for _ in range(N)] for _ in range(N)]
p[0][0].append('a')
for i in range(1,N):
  for j in r[i]:
    x = ord(j)-97
    for n,k in enumerate(p[i-1][max(0,x-1):],max(0,x-1)):
      for m in k:
        p[i][max(n,x)].append(m+j)


p = p[-1]
p = list(itertools.chain.from_iterable(p))
p = sorted(p)
for q in p:
  print(q)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
import itertools
from collections import deque
ans = deque()
l = []
for i in range(N):
  l.append(chr(97+i))
  for x in itertools.product(l, repeat=N):
    f = [0]*10
    x = list(x)
    judge = True
    k = False
    for w in x:
      w = ord(w)-97
      f[w]=1
      if w==0:
        continue
      elif f[w-1]==1:
        continue
      else:
        k = True
        
    if k:
      continue
    else:
      ans.append(''.join(x))
ans = set(ans)
ans = sorted(list(ans))
for a in ans:
  print(a)

Fixed submission:
N = int(input())
from collections import deque
import itertools
ans = deque()
l = []
r = deque()
for i in range(N):
  l.append(chr(97+i))
  r.append(l.copy())
  

p = [[[] for _ in range(N)] for _ in range(N)]
p[0][0].append('a')
for i in range(1,N):
  for j in r[i]:
    x = ord(j)-97
    for n,k in enumerate(p[i-1][max(0,x-1):],max(0,x-1)):
      for m in k:
        p[i][max(n,x)].append(m+j)


p = p[-1]
p = list(itertools.chain.from_iterable(p))
p = sorted(p)
for q in p:
  print(q)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
import itertools
from collections import deque
ans = deque()
l = []
for i in range(N):
  l.append(chr(97+i))
  for x in itertools.product(l, repeat=N):
    f = [0]*10
    x = list(x)
    judge = True
    k = False
    for w in x:
      w = ord(w)-97
      f[w]=1
      if sum(f[:w])>=w:
        continue
      else:
        k = True
        
    if k:
      continue
    for j,y in enumerate(x[:i+1]):
      if y in l[:j+1]:
        continue
      else:
        judge=False
        break
    if judge:
      ans.append(''.join(x))
  
ans = set(ans)
ans = sorted(list(ans))
for a in ans:
  print(a)

Fixed submission:
N = int(input())
from collections import deque
import itertools
ans = deque()
l = []
r = deque()
for i in range(N):
  l.append(chr(97+i))
  r.append(l.copy())
  

p = [[[] for _ in range(N)] for _ in range(N)]
p[0][0].append('a')
for i in range(1,N):
  for j in r[i]:
    x = ord(j)-97
    for n,k in enumerate(p[i-1][max(0,x-1):],max(0,x-1)):
      for m in k:
        p[i][max(n,x)].append(m+j)


p = p[-1]
p = list(itertools.chain.from_iterable(p))
p = sorted(p)
for q in p:
  print(q)