Here, p is the name of the same object than q (i mean, they both are the name of the same location in memory). Hence, your question is not well defined, since Sage (or Python) will not be able to make a difference between p and q. If you need such a feature, there may a better way to write your progam.

That said, you can try to look for your variable in the globals() dictionary: