import java.util.Arrays;
import java.util.Scanner;
public class Main {
static int L, M;
static char[] arr;
static char[] selected;
static StringBuilder sb = new StringBuilder();
static boolean isValid() {
int consonant = 0, vowel = 0;
for (int i = 1; i <= L; i++) {
char x = selected[i];
if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') {
vowel++;
} else {
consonant++;
}
}
return consonant >= 2 && vowel >= 1;
}
static void rec_func(int k, int index) {
if (k == L + 1) {
if (isValid()) {
for (int i = 1; i <= L; i++) {
sb.append(selected[i]);
}
sb.append('\n');
}
return;
}
for (int i = index; i <= M; i++) {
selected[k] = arr[i];
rec_func(k + 1, i + 1);
selected[k] = '\0';
}
}
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
L = kb.nextInt();
M = kb.nextInt();
arr = new char[M + 1];
selected = new char[L + 1];
for (int i = 1; i <= M; i++) {
arr[i] = kb.next().charAt(0);
}
Arrays.sort(arr, 1, M + 1);
rec_func(1, 1);
System.out.println(sb.toString());
}
}