#include <stdio.h>
#include <stdlib.h>

typedef struct list {
    struct list *m_pNext;
    int m_value;
} List;
 
List *list_insert(List *pHead, int value)
{
    List *pNew = malloc(sizeof(List));
    pNew->m_value = value;
    pNew->m_pNext = pHead;
    
    return pNew;
}

List *list_sorted_insert(List *pHead, int value)
{
    List *p, *pPrev = NULL;
    
    for (p = pHead; p; p = p->m_pNext) {
	if (value <= p->m_value) {
	    break;
	}
	pPrev = p;
    }
    
    List *pNew = list_insert(p, value);
    
    if (pPrev) {
	pPrev->m_pNext = pNew;
    } else {
	pHead = pNew;
    }
    
    return pHead;
}

void list_print(List *pHead)
{
    List *p;
    
    for (p = pHead; p; p = p->m_pNext) {
	printf("%d ", p->m_value);
    }
    printf("\n");
}

void list_free(List *pHead)
{
    List *p, *q;
    
    for (p = pHead; p; p = q) {
	q = p->m_pNext;
	free(p);
    }
}
 
int main()
{
    List *pHead = NULL;
    int value;
    
    for (; ;) {
	if (scanf("%d", &value) < 1) {
	    continue;
	}
	if (value < 0) {
	    break;
	}
	
	pHead = list_sorted_insert(pHead, value);
    }
    
    list_print(pHead);
    
    list_free(pHead);
    
    return 0;
}
