Qualcomm interview question

Implement queue using two stack. How to design a system to avoid deadlock.