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

int left(int i){
  return 2 * i;
}

int right(int i){
  return 2 * i + 1;
}

void maxHeapify(int* h, int i, int n){
  
  int l, r, x, largest;
  
  l = left(i);
  r = right(i);
  
  if(l <= n && h[l] > h[i]) largest = l;
  else largest = i;
  
  if(r <= n && h[r] > h[largest]) largest = r;
  
  if(largest != i){
    x = h[i];
    h[i] = h[largest];
    h[largest] = x;
    
    maxHeapify(h, largest, n);
    
  } 
}

void buildMaxHeap(int* h, int n){
  
  int i;
  
  for(i = n / 2; i > 0; i--) maxHeapify(h, i, n);

}


int main(){
  
  int i, n;
  char com[10];
  
  while(com[0] != 'e' && com[1] != 'n'){
    scanf("%s", com);
    
    if(com[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }
    else if(com[0] == 'e');
  }
  
  return 0;
  
}