#include <stdio.h>

#define N 100000

int partition(char *, int, int);
void quicksort(char *, int, int);

char A[N];

int main(){

  int n, i, j, a, c;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%s", A[i]);
  }

  quicksort();

  return 0;
}

int partition(char *A, int p, int r){

  int x, i, j, tmp1, tmp2;

  x = A[r];
  i = p - 1;

  for(j=p; j<=r-1; j++){
    if(A[j] <= x){
      i = i+1;
      tmp1 = A[i];
      A[i] = A[j];
      A[j] = tmp1;
    }
  }

  tmp2 = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp2;

  return i+1;
  
}

void quicksort(char *A, int p, int r){

  int q;

  if(p < r){
    q = partition(A,p, r);
    quicksort(A, p, q-1);
    quicksort(A, q+1, r);
  }
}