let p = readLine()!.split(separator: " ").map{Int(String($0))!}
let (end,n) = (p[0],p[1])
let char = readLine()!.split(separator: " ").map{String($0)}.sorted()
let vowels:Set<Character> = ["a","i","u","e","o"]
func dfs(_ idx:Int,_ depth:Int,_ str:String) {
if depth == end {
var v = false
var c = 0
for i in str {
if vowels.contains(i) {
v = true
} else {
c += 1
}
}
if v, 2<=c {
print(str)
}
return
}
for i in idx..<n {
dfs(i+1, depth+1, str+char[i])
}
}
dfs(0, 0, "")