import java.io.*;

import java.util.*;

public class Main{
    public static void main(String[] args) throws Exception {
        Scanner s = new Scanner(new File("ship.in"));
        PrintWriter pt = new PrintWriter(new File("ship.out"));
        int n = s.nextInt();
        int k = s.nextInt();
        int p = s.nextInt();
        int curr = 0;
        int max = 0;
        Stack<Integer>[] dep = new Stack[k];
        Arrays.fill(dep, new Stack<Integer>());
        boolean error = false;
        for(int i = 0; i < n; i++){
            String c = s.next();
            if(c.equals("+")){
                int a = s.nextInt();
                a--;
                int b = s.nextInt();
                dep[a].push(b);
                curr++;
                if(curr > max) max = curr;
                if(curr > p){
                    error = true;
                    break;
                }
            }
            else{
                int a = s.nextInt();
                a--;
                int b = s.nextInt();

                if(dep[a].size() == 0){
                    error = true;
                    break;
                }
                int barrel = dep[a].pop();
                curr--;
                if(barrel!= b){
                    error = true;
                    break;
                }
            }
        }
        if(curr !=0) error = true;
        if(error)
            pt.println("Error");
        else
            pt.println(max);

        pt.close();
    }

}