The stack follows First In First Out principle. When a,b and c are pushed then c is at the top (Current stack: a,b,c,_,_). When f is pushed then f is at the top (Current Stack: a,b,c,f,_). Popping will remove top element, so f is removed (Current Stack: a,b,c,_,_). When h is pushed then h is at the top (Current Stack: a,b,c,h,_). Popping will remove top element, so h is removed (Current Stack: a,b,c,_,_). When m is pushed then m is at the top (Current Stack: a,b,c,m,_). Popping will remove top element, so m is removed. Final Stack: a,b,c,_,_ with c at the top and 2 empty positions.