import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
String s=br.readLine();
Node root=new Node(Integer.parseInt(s));
while(true){
s=br.readLine();
if(s==null|| s.isEmpty())break;
root.insert(Integer.parseInt(s));
}
root.postOrder();
}
static class Node{
int num;
Node left,right;
Node(int num){
this.num=num;
left=null;
right=null;
}
public void insert(int number){
if(number<num){
if(left==null){
left=new Node(number);
}
else{
left.insert(number);
}
}
else{
if(right==null){
right=new Node(number);
}
else{
right.insert(number);
}
}
}
public void postOrder(){
if(left!=null){
left.postOrder();
}
if(right!=null){
right.postOrder();
}
System.out.println(num);
}
}
}
#트리