stack to queue conversion