// C++
//#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int l;
int c;
const string VOWELS = "aeiou";
void generateStringPermutation(string& words, int depth, string& letter) {
int consonantsCount = 0;
int vowelsCount = 0;
if (depth == l)
{
for (char word : letter)
{
if (VOWELS.find(word) != string::npos)
++vowelsCount;
else
++consonantsCount;
}
if (vowelsCount >= 1 && consonantsCount >= 2)
{
cout << letter << '\n';
}
return;
}
for (int i = depth; i < c; ++i) {
letter[depth] = words[i];
// 값이 들어올 때 오름차순이 유지되는지 검사
if (depth > 0 && letter[depth - 1] >= letter[depth]) {
continue;
}
generateStringPermutation(words, depth + 1, letter);
}
}
int main() {
cin.tie(NULL);
ios::sync_with_stdio(false);
cin >> l >> c;
string words;
words.resize(c);
for (char& word : words) {
cin >> word;
}
sort(words.begin(), words.end());
string letter(l, ' ');
generateStringPermutation(words, 0, letter);
return 0;
}
for (int i = depth; i < c; ++i) {
letter[depth] = words[i];
// 값이 들어올 때 오름차순이 유지되는지 검사
if (depth > 0 && letter[depth - 1] >= letter[depth]) {
continue;
}
generateStringPermutation(words, depth + 1, letter);
}