#include<stdio.h>
#define N 200000

int A[N],B[N],C[N],n;

void count(int A[],int B[], int k){
  int i,j;
  for(i = 0; i < k; i++)
    C[i] = 0;
  
  for(j = 0; j < n; j++)
    C[A[j]]++;
  
  for(i = 1; i < k; i++)
    C[i] += C[i-1];

  for(j = n; j > 1; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}



int main(){
  int i;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
    count(A,B,n);
    printf("a%d ", A[i]);
    printf("b%d ", B[i]);
    printf("c%d \n", C[i]);
  }

  printf("\n");

  return 0;
}


  

