public static void main(String[] args) {
boolean flag = true;
List<String> ls = new ArrayList<String>();
Scanner in = new Scanner(System.in);
while (flag && in.hasNext()) {
String s = in.next();
ls.add(s);
if ("end".equals(s)) { // 防止空指针
flag = false;
in.close();
break;
}
}
int size = ls.size();
for (int i = 0; i < size; i++) {
System.out.println(ls.get(size - i - 1));
}
}