class NoListaB {

    int peso;
    NoListaB next;

    NoListaB (int n) {
        this.peso = n;
        this.next = null;
    }
}

class ListaB {

    NoListaB inicio;

    ListaB() {
        this.inicio = null; 
    }

    String imprimir() {
        NoListaB temp = this.inicio;
        String retorno = temp.peso + "";
        while (temp.next != null) {
            temp = temp.next;
            retorno = retorno + " " + temp.peso;
        }
        return retorno;
    }

    
    void inserir(NoListaB no) {
        NoListaB temp = this.inicio;
        if (temp == null) {
            temp = no;
            this.inicio = temp;
        } else {
            if (no.peso < temp.peso) {
                no.next = temp;
                temp = no;
                this.inicio = temp;
            } else {
                while (temp.next != null && no.peso > temp.next.peso) {
                    temp = temp.next;
                }
                no.next = temp.next;
                temp.next = no; 
            }
        }
    }
}

public class QuestaoB {

    static void main (String[] Args) {
        Arquivo arq = new Arquivo("QuestaoB.in", "QuestaoB.out");
        ListaB lista = new ListaB();
        NoListaB no;
        int peso;
        while (!arq.isEndOfFile()) {
            peso = arq.readInt();
            no = new NoListaB(peso);
            lista.inserir(no);
            arq.println(lista.imprimir());
        }  
        arq.close();
    }
}