class CQueue {
Stack<Integer> inStack, outStack;
public CQueue() {
this.inStack = new Stack<>();
this.outStack = new Stack<>();
}
public void appendTail(int value) {
this.inStack.push(value);
}
public int deleteHead() {
if (this.outStack.size() == 0 && this.inStack.size() == 0) return -1;
if (this.outStack.size() == 0) {
while (this.inStack.size() != 0) {
this.outStack.push(this.inStack.pop());
}
}
return this.outStack.pop();
}
}
/**
* Your CQueue object will be instantiated and called as such:
* CQueue obj = new CQueue();
* obj.appendTail(value);
* int param_2 = obj.deleteHead();
*/