let num;
while(num=readline()){
let arr=[];
for(let i=0;i<num;i++){
const read=readline();
arr.push(read)
}
let res=arr.sort()
res.map(item=>console.log(item))
}
let num;
while(num=readline()){
let arr=[];
for(let i=0;i<num;i++){
const read=readline();
arr.push(read)
}
let res=arr.sort()
res.map(item=>console.log(item))
}