import java.util.*;
import gov.nasa.jpf.jvm.*;

public class TestBitBucket {
    public static void main(String[] param) {
	PriorityQueue pq = new Heap();
	BitBucket correct = new BitBucket();
	int rounds = Verify.getInt("rounds");
	for (int i = 0; i < rounds; i++) {
	    if (Verify.getBoolean()) {
		int value = Verify.getInt("value");
		pq.enqueue(value);
		correct.enqueue(value);
	    } else {
		assert(pq.isEmpty() == correct.isEmpty());
		Verify.ignoreIf(pq.isEmpty());
		int v1 = (Integer) pq.removeFirst();
		int v2 = correct.removeFirst();
		assert v1 == v2;
	    }
	} 

	while (!pq.isEmpty()) {
	    assert (!correct.isEmpty());
	    int v1 = (Integer) pq.removeFirst();
	    int v2 = correct.removeFirst();
	    assert v1 == v2;
	}
    }
}
