How do I prove this?

$\displaystyle p\rightarrow (q \rightarrow p)$?

I did the truth table, and I understand it, but I don't understand the proof in Cauman's book First order logic. Actually, I don't see how it makes sense.

Here's what she did:

http://www.imageupload.org/?di=6129311572713]

How do I get $\displaystyle q \rightarrow p$ just by two premises I introduced and repeated one of them?

Please help.

Thank you.