application of stack and queue