Heaping up with the inqueries
I had no problems using a SortedSet, which is both more clear and more efficient than your implementation. You should use Scanner#nextInt() instead of parsing strings yourself. 

I'm currently on a Java 6 machine. Other changes I'd suggest in Java 7+:
You should also close your scanner (use a try-with-resources block). You should prefer a PriorityQueue to a TreeSet, because as @JerryCoffin++ has already pointed out, a heap is probably the correct data structure to be using (depending on the implementation details and frequency of removes, in some cases the TreeSet may perform better).

import java.util.Scanner;
import java.util.SortedSet;
import java.util.TreeSet;

public class QHeap1 {

    public static void main(final String[] args) {
        final Scanner input = new Scanner(System.in);
        final int numberOfCommands = input.nextInt();
        final SortedSet&lt;Integer&gt; set = new TreeSet&lt;Integer&gt;();

        for (int i = 0; i &lt; numberOfCommands; i++) {
            final int command = input.nextInt();
            switch (command) {
            case 1: 
                set.add(input.nextInt());
                break;
            case 2:
                set.remove(input.nextInt());
                break;
            case 3:
                System.out.println(set.first());
                break;
            default:
                throw new IllegalStateException();
            }
        }
    }
}