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

int ordena(const void * a, const void * b)
{
    char **palavra1 = (char**) a;
    char **palavra2 = (char**) b;
    return strcmp(*palavra1, *palavra2);
}

int main(int argc, char** argv)
{
  char **nomes, frase[900], *ponteiro;
  nomes = malloc(sizeof(char*) * 3000);
  int indice, cont = 0, i;
  for(indice = 0; indice < 3000; indice++)
  {
    nomes[indice] = malloc(sizeof(char) * 100);
  }

  scanf("%[^\n]", frase);

  ponteiro = strtok(frase, " ");
  while(ponteiro != NULL)
  {
     strcpy(nomes[cont], ponteiro);
     cont++;
     ponteiro = strtok(NULL, " ");
  }
  qsort(nomes, cont, sizeof(nomes[0]), ordena);
  for(i = 0; i < cont; i++)
  {
    printf("%s\n", nomes[i]);
  }

   return 0;
}
