Without consecutive consonants

Given nn lowercase letters, print all the ways to arrange them so that no two consonants are consecutive.

Input

Input consists of the number of letters nn, followed by nn lowercase letters, all different.

Output

Print, in alphabetical order, all the words without two consecutive consonants that can be made up using all the letters exactly once. There will always be at least one possible word.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T12:18:13.929Z

© Jutge.org, 2006–2026.
https://jutge.org