var
a,st:array[0..9]of string;
c:array[0..9]of boolean;
i,j,n:longint;
str:string;
procedure try(t:longint);
var
i:longint;
begin
if t>n then begin{輸出}
for i:=1 to t-2 do
write(a[i],'-');
writeln(a[t-1]);
end;
for i:=1 to n do
if c[i] then{若這個名字沒用過,則就使用這個名字}
begin
c[i]:=false;
a[t]:=st[i];{將順序記錄下來}
try(t+1);
c[i]:=true;
end;
end;
begin
readln(n);
for i:=1 to n do
readln(st[i]);
for i:=1 to n-1 do
for j:=i+1 to n do {排序,為了字典序輸出}
if st[i]>st[j] then begin
str:=st[i];st[i]:=st[j];st[j]:=str;
end;
fillchar(c,sizeof(c),true);
try(1);{進入過程)
end.