Qiskit gates out of order?

I'm running the following piece of code and get the following output.

n = 4
qc = QuantumCircuit(n)
for i in range(n - 1, -1, -1):
qc.h(i)
print("h", i)
for j in range(i - 1, -1, -1):
qc.cp(math.pi / 2 ** (i - j), j, i)
print("cp", j, i)
qc.draw()


I'm wondering why the second H gate appears before the third CP gate?

New contributor
Freeman Cheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.