#include <stdio.h>
#include <string.h>
#include <ctype.h>

int my_string_compare(const char * a, const char * b)
{
	int my_result;

	while (*a || *b)
	{
		if ((my_result = tolower(*a) - tolower(*b)))
			return my_result;
		if (*a != *b)
			return (islower(*a)) ? -1 : 1;
		a++;
		b++;
	}

	return 0;
}

int main( )
{
	char c;
	char name[20][10], temp[10];
	int count_name = 0;
	int name_index = 0;
	int i, j;

	while ((c = getchar( )) != EOF)
	{
		if (c == 10)
		{
			name[count_name][name_index] = '\0';
			count_name++;
			name_index = 0;
		}
		else
		{
			name[count_name][name_index] = c;
			name_index++;
		}
	}

	for (i = 0; i < count_name - 1; i++)
	{
		for (j = i + 1; j< count_name; j++)
		{
			if (my_string_compare(name[i], name[j]) > 0)
			{
				strcpy(temp, name[i]);
				strcpy(name[i], name[j]);
				strcpy(name[j], temp);
			}
		}
	}

	for (i = 0; i < count_name; i++)
	{
		printf("%s\n", name[i]);
	}
}