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

struct list {
	int		val;
	struct list	*next;
};

void insert(struct list **pp, int val)
{
	struct list *p;

	p = malloc(sizeof (struct list));
	p->val = val;
	while (*pp) {
		if ((*pp)->val >= val) break;
		pp = &(*pp)->next;
	}
	p->next = *pp;
	*pp = p;
}

int main()
{
	struct list *p, *next, *head = NULL;
	int val;

	while (1) {
		scanf("%d", &val);
		if (val < 0) break;
		insert(&head, val);
	}
	for (p = head; p; p = next) {
		printf("%d ", p->val);
		next = p->next;
		free(p);
	}
	printf("\n");
	return 0;
}
