class MyStack {public: /** Initialize your data structure here. */ MyStack() {} /** Push element x onto stack. */ void push(int x) { que1.push(x); } /** Removes the element on top of the stack and returns that element. */ int pop() { int t = top(); helper(que1, que2); helper1(que2, que1); return t; } /** Get the top element. */ int top() { return que1.back(); } /** Returns whether the stack is empty. */ bool empty() { return que1.empty(); }PRivate: void helper( queue<int>& q1, queue<int>& q2 ){ while(!q1.empty()){ int front = q1.front(); q1.pop(); if(!q1.empty()) q2.push(front); } } void helper1( queue<int>& q1, queue<int>& q2 ){ while(!q1.empty()){ int front = q1.front(); q1.pop(); q2.push(front); } }private: queue<int> que1; queue<int> que2;};/** * Your MyStack object will be instantiated and called as such: * MyStack obj = new MyStack(); * obj.push(x); * int param_2 = obj.pop(); * int param_3 = obj.top(); * bool param_4 = obj.empty(); */