How was petra built?

Can you answer this question?