/**
 * Created by IntelliJ IDEA.
 * User: m09cke
 * Date: 18.11.2009
 * Time: 17:07:50
 * To change this template use File | Settings | File Templates.
 */
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;

public class Main implements Runnable{

   public void run(){
       try{
           //StreamTokenizer in = new StreamTokenizer( new BufferedReader( new FileReader( new File( "ship.in"))));
           Scanner in = new Scanner(new FileReader( new File( "ship.in")));
           PrintStream out = new PrintStream(new File("ship.out"));
           /*in.nextToken();
           int n = (int)in.nval;
           in.nextToken();
           int k = (int)in.nval;
           in.nextToken();
           int p = (int)in.nval;*/
           int n = in.nextInt();
           int k = in.nextInt();
           int p = in.nextInt();
           int m = 0;
           int count = 0;
           boolean t = true;
           int[] num = new int[k];
           ArrayList[] a = new ArrayList[k];
           for (int i=0; i<k; i++){
               a[i] = new ArrayList<Integer>();
               num[i]=0;
           }
           for (int i=0; i<n; i++){
               if (t){
                   /*in.nextToken();
                   char sign = in.sval.charAt(0);
                   in.nextToken();
                   int A = (int)in.nval;
                   in.nextToken();
                   int B = (int)in.nval;*/
                   char sign = in.next().charAt(0);
                   int A = in.nextInt()-1;
                   int B = in.nextInt();
                   int fs = num[A];
                   if(sign=='-'){
                       if (fs==0){t=false;}
                       else{
                           if (a[A].get(fs-1).equals(B)){
                               a[A].remove(fs-1);
                               num[A]--;
                               count--;
                           }
                           else{t=false;}
                       }
                   }
                   else{
                       if (fs==p){t=false;}
                       else{
                           num[A]++;
                           count++;
                           if (count>m){m=count;}
                           a[A].add(B);
                       }
                   }
               }
           }
           if (!t){
               out.println("Error");
           }
           else{
               out.println(m);
           }
       }
       catch(Exception e){
           e.printStackTrace();
           System.exit(1);
       }
   }

   public static void main(String[] args){
       new Thread(new Main()).start();
   }

}