Python solution of stacks and queues part