| 99 | public static String[] splits; |
| 100 | |
| 101 | public static void main(String[] args) throws IOException { |
| 102 | BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); |
| 103 | PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); |
| 104 | String line = null; |
| 105 | while ((line = in.readLine()) != null) { |
| 106 | build(); |
| 107 | m = Integer.valueOf(line); |
| 108 | for (int i = 1; i <= m; i++) { |
| 109 | splits = in.readLine().split(" "); |
| 110 | op = Integer.valueOf(splits[0]); |
| 111 | if (op == 1) { |
| 112 | insert(splits[1]); |
| 113 | } else if (op == 2) { |
| 114 | delete(splits[1]); |
| 115 | } else if (op == 3) { |
| 116 | out.println(search(splits[1]) > 0 ? "YES" : "NO"); |
| 117 | } else if (op == 4) { |
| 118 | out.println(prefixNumber(splits[1])); |
| 119 | } |
| 120 | } |
| 121 | clear(); |
| 122 | } |
| 123 | out.flush(); |
| 124 | in.close(); |
| 125 | out.close(); |
| 126 | } |
| 127 | |
| 128 | } |