/*
1.题目描述:给定n个字符串,请对n个字符串按照字典序排列。
2.题目链接:https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723?tpId=37&tqId=21237&tPage=1&rp=&ru=/ta/huawei&qru=/ta/huawei/question-ranking
*/
/*
1.问题描述:next、nextInt、nextDobule、nextFloat等与nextLine先后使用时,会造成nextLine读取数据丢失第一个数据;
2.原因分析:nextLine会把前者的结束符“换行符”作为字符串读入,进而不需要从键盘输入字符串nextLine已经转向下一条语句执行;
3.解决方案:在next、nextInt、nextDobule、nextFloat等输入方法后,添加一个无用的的sc.nextLine(),过滤“换行符”;
4.next和nextLine区别:
next:从控制台获取字符串,如果字符串中包含空格,只会获取第一个作为接收的字符串;
nextLine:从控制台获取字符串,字符串中可以包含空格,以回车符作为接收结束标志。
5.参考链接:
https://blog.csdn.net/tuke_tuke/article/details/51330086
https://blog.csdn.net/homedjy/article/details/8733270
http://blog.51cto.com/simoniu/1587828
*/
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
sc.nextLine();
String[] str=new String[n];
for(int i=0;i<n;i++){
str[i]=sc.nextLine();
}
Arrays.sort(str);
for(int j=0;j<n;j++){
System.out.println(str[j]);
}
}
}