a=b(mod m)
a=b(mod n)
so m|(a-b) and n|(a-b)
since m,n are coprime, mn|(a-b).
this is kind of "obvious" because they share no common prime factors. so if mr=ns, m=s and n=r. if you need to prove this, you may use the fundamental theorem of arithmetic or can try writing it as a linear combination: mp+nq=1.