#include <stdio.h>

int main(){
  int dat[1024];
  int max = 0;
  int itr;
  char str[8];
  int num;
  while(1){
  scanf("%s %d", &str, &num);
  if (strcmp(str, "insert") == 0){
    if (num > max) max = num;
    dat[itr] = num;
  } else if ( strcmp(str, "extract") == 0){
    printf("%d", max);
  } else return 0;
  }
  return 0;
}