#include <cstdio>
  

  int first[150000],next[150000],type[150000],empty,ans;

int main(){       
  freopen("ship.in","r",stdin);
  freopen("ship.out","w",stdout);
  int n,k,p;
  scanf("%d%d%d\n",&n,&k,&p);
  char c;
  empty=1;
  ans=0;
  int q=0;
  type[0]=-1;
  for (int i=0;i<n;i++){
    int num,t;
    scanf("%c%d%d\n",&c,&num,&t);
    if (c=='+'){
      type[empty]=t;
      next[empty]=first[num];
      first[num]=empty;
      empty++;

      q++;
      if (q>ans){
        if (q>p){
          printf("Error\n");
          return 0;
        }
        ans=q;
      }
    }
    else{
      if ((first[num]==0) || (t!=type[first[num]])){
        printf("Error\n");
        return 0;
      }
      
      first[num]=next[first[num]];
      q--;
    }

  }

  if (q!=0)
    printf("Error\n");
  else
    printf("%d\n",ans);


  return 0;
}