The first mathematician: Frodo
The second mathematician: Saruman
Frodo has $x$ and Saruman has $y$.
Frodo thinks that Saruman has either $6^{12/x}$ or $6^{12}/x$.
Saruman thinks that Frodo has $6^{12/y}$ or $6^{12}/y$.
I derived an answer based on that but I'm not sure if it's correct. The answer is:
The first one has $6^6$ and the second one has $6^6$