果断搜
Program P3049;
var
n,i,j,m:longint;
a:array[1..26] of char;
b:array['a'..'z'] of boolean;
c:char;
procedure swap(var a,b:char);
var
t:char;
begin
t:=a;a:=b;b:=t;
end;
procedure dfs(father:longint;s:string;flag:boolean;l:longint);
var
i:longint;
begin
if l=n then
begin
if flag then writeln(s);
exit;
end;
for i:=father+1 to m-(n-l)+1 do
dfs(i,s+a[i],flag or b[a[i]],l+1);
end;
begin
fillchar(b,sizeof(b),false);
b['a']:=true;b['e']:=true;b['i']:=true;b['o']:=true;b['u']:=true;
readln(n,m);
for i:=1 to m do
begin
read(a[i]);
read(c);
end;
for i:=1 to m-1 do
for j:=i+1 to m do
if ord(a[i])>ord(a[j]) then swap(a[i],a[j]);
if n<3 then halt;
dfs(0,'',false,0);
end.