cho.sh
Notes
Loading...

Password Generation

Time limit

2s

Memory limit

128 MB

Problem

A lab has installed a new security system that opens with a password instead of a key.

A password consists of L distinct lowercase English letters. It must contain at least one vowel (a, e, i, o, u) and at least two consonants. The letters in a password are assumed to appear in increasing alphabetical order. abc has the required form, while bac does not.

Given the C letters that may be used, write a program that prints every possible password satisfying these conditions in lexicographic order.

Input

The first line contains two integers L and C. (3 <= L <= C <= 15)

The second line contains C lowercase English letters separated by spaces. All given letters are distinct.

Output

Print every password satisfying the conditions in lexicographic order, one per line.