#include<bits/stdc++.h>
using namespace std;
class Stack{
queue q1,q2;
int cs;
public:
Stack(){
this->cs=0;
}
bool isEmpty(){
return this->cs==0;
}
void Push(int data){
//Push the element in one of the queue
if(q2.empty()){
q2.push(data);
}
//Pop all the elements from one of the queue and push it in the other
//queue until the queue becomes empty.
while(!q1.empty()){
q2.push(q1.front());
q1.pop();
}
//Swap the names of the queues
queue<int> q;
q=q1;
q1=q2;
q2=q;
//Increment the size of the array
cs++;
}
void Pop(){
if(q1.empty() && q2.empty()){
return;
}
while(q1.size()!=1){
q2.push(q1.front());
q1.pop();
}
q1.pop();
queue<int>q=q1;
q1=q2;
q2=q;
cs--;
}
int top(){
if(q1.empty()){
return 0;
}
return q1.front();
}
int size(){
return cs;
}
};
int main(){
Stack S;
for(int i=1;i<=10;i++){
S.Push(i);
}
// S.Pop();
// S.Push(11);
while(!S.isEmpty()){
cout<<S.top()<<" ";
S.Pop();
}
return 0;
}