Amazon interview question

Simulate a FIFO and LIFO heap in either Java or Python.