program panasonic2020_d
    use,intrinsic :: iso_fortran_env
    implicit none

    character(10):: c='a'
    integer(int32):: n

    read*, n
    call make_standard(n,c)
contains
recursive subroutine make_standard(n,c)
    integer(int32):: n,i
    character(*):: c
    character(1):: cmax

    if (n==1) then
        print'(a)', c
        return
    end if

    cmax = 'a'

    do i=1,len_trim(c)
        cmax = max(cmax, c(i:i))
    end do

    do i=ichar('a'), ichar(cmax)+1
        call make_standard(n-1, trim(c)//char(i))
    end do

    
end subroutine
end program panasonic2020_d