Let a, x, n, y in Z, n>1. Prove that if ax is congruent to ay(mod n), then x is congruent to y (mod n/d), where d = (a,n).

Question: How do I do the congruence equal sign thing, and other stuff like that. Also, a, x, n, y in Z. How do I do the symbol to show they are in the set Z? Thanks.