Consonants and vowels

Write a program that reads nn consonants and nn vowels, and prints all the words that can be made up by using each letter exactly once. The words must begin with a consonant, and alternate consonants and vowels. In this exercise, we will assume that ‘y’ is a vowel.

Input

Input consists of a natural number nn between 1 and 6, followed by nn different consonants and nn different vowels. Both consonants and vowels are given in alphabetical order.

Output

Print the words that can be made up with the 2n2n given letters, starting with a consonant and always alternating consonants and vowels. Print the words in alphabetical order, one per line.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:30:27.446Z

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