Buggy python submission (verdict: Runtime Error):
n = int(input())

def dfs(str s):
  if len(s) == n:
    print(s)
  else:
    for i in range(int(s[len(s) - 1] - 'a')):
      dfs(s)

Fixed submission:
n = int(input())

def dfs(s):
  if len(s) == n:
    print(s)
  else:
    for i in range(ord(max(s)) - ord('a') + 2):
      dfs(s + chr(i + ord('a')))
      
s = 'a'
dfs(s)

Buggy python submission (verdict: Runtime Error):
n = int(input())
import sys

a = 'abcdefghij'
s = 'a'
count = 0

if n == 1:
  print('a')
  sys.exit()

for i in range(2):
  s.append(a[i])
  if i == 0:
    count += 1
  if count == n - 1:
    print(s)
    break
  for j in range(i + 1):
    s.append(a[i])
    if i == 0:
      count += 1
    if count == n - 1:
      print(s)
      break
    for k in range(j + 1):
      s.append(a[i])
      if i == 0:
        count += 1
      if count == n - 1:
        print(s)
        break
      for l in range(k + 1):
        s.append(a[i])
        if i == 0:
          count += 1
        if count == n - 1:
          print(s)
          break
        for m in range(l + 1):
          s.append(a[i])
          if i == 0:
            count += 1
          if count == n - 1:
            print(s)
            break
          for o in range(m + 1):
            s.append(a[i])
            if i == 0:
              count += 1
            if count == n - 1:
              print(s)
              break
            for p in range(o + 1):
              s.append(a[i])
              if i == 0:
                count += 1
              if count == n - 1:
                print(s)
                break
              for q in range(p + 1):
                s.append(a[i])
                if i == 0:
                  count += 1
                if count == n - 1:
                  print(s)
                  break

Fixed submission:
n = int(input())

def dfs(s):
  if len(s) == n:
    print(s)
  else:
    for i in range(ord(max(s)) - ord('a') + 2):
      dfs(s + chr(i + ord('a')))
      
s = 'a'
dfs(s)

Buggy python submission (verdict: Runtime Error):
n = int(input())
import sys

a = 'abcdefghij'
s = 'a'
count = 0

if n == 1:
  print('a')
  sys.exit()

for i in range(2):
  s.append(a[i])
  if i == 0:
    count += 1
  if count == n - 1:
    break
  for j in range(i + 1):
    s.append(a[i])
    if i == 0:
      count += 1
    if count == n - 1:
      break
    for k in range(j + 1):
      s.append(a[i])
      if i == 0:
        count += 1
      if count == n - 1:
        break
      for l in range(k + 1):
        s.append(a[i])
        if i == 0:
          count += 1
        if count == n - 1:
          break
        for m in range(l + 1):
          s.append(a[i])
          if i == 0:
            count += 1
          if count == n - 1:
            break
          for o in range(m + 1):
            s.append(a[i])
            if i == 0:
              count += 1
            if count == n - 1:
              break
            for p in range(o + 1):
              s.append(a[i])
              if i == 0:
                count += 1
              if count == n - 1:
                break
              for q in range(p + 1):
                s.append(a[i])
                if i == 0:
                  count += 1
                if count == n - 1:
                  break
print(s)
                
  

Fixed submission:
n = int(input())

def dfs(s):
  if len(s) == n:
    print(s)
  else:
    for i in range(ord(max(s)) - ord('a') + 2):
      dfs(s + chr(i + ord('a')))
      
s = 'a'
dfs(s)