Show that if $G_1$ and $G_2$ are two finite groups and the number of distinct group homomorphisms from $G_1$ to $H$ is equal to that of $G_2$ to $H$ for every finite group $H$, then that $G_1$ and $G_2$ are isomorphic .
It's a problem in IMS 2014 .
Actually, I have tried to show $|G_1|= |G_2|$ , primarily, and if there exists an onto homomorphism from $G_1$ onto $G_2$, then our assertion will be done. But, I can't approach properly! Here, I have found an answer on Aops
But, I want a different approach .