classMyQueue{private Stack<Integer> in =newStack<>();private Stack<Integer> out =newStack<>();/** Initialize your data structure here. */publicMyQueue(){}/** Push element x to the back of queue. */publicvoidpush(int x){
in.push(x);}/** Removes the element from in front of queue and returns that element. */publicintpop(){if(out.isEmpty()){while(!in.Empty()){
out.push(in.pop());}}return out.pop();}/** Get the front element. */publicintpeek(){if(out.isEmpty()){while(!in.Empty()){return out.push(in.pop());}}return out.peek();}/** Returns whether the queue is empty. */publicbooleanempty(){return out.isEmpty()== in.isEmpty();}}