The first mathematician: F
The second mathematician: S
F has $x$ and S has $y$.
F thinks that S has a number in the form of $6^{12/x}$ or $6^{12}/x$.
S thinks that F has a number in the form of $6^{12/y}$ or $6^{12}/y$.
Let's say $G_1=\{2,3,4,6,12\}$ are the sets of number that can be used in $6^{12/z}$ and to get a whole number (I didn't include $1$ for obvious reasons) and let $G_2=\{6^2,6^3,6^4,6^6\}$ be the numbers that can not be used in $z^{G_1}$. We call $G$ as the union of $G_1$ and $G_2$.
Now see a table:
From OUR point of view:
If F had numbers in the red row he could easily guess S's number. He says I don't know, which means he has $6,6^2,6^3,6^4,6^6$.We are confused between green cells and red cells, for $6^6$ between green and blue cell.
S says at first he didn't know, which means he had notdidn't have a number in red column, if not he could easily guessed F's number. Also he knows that F does not have a number in red row, if F had he would guess S's number. Since we eliminated red rows now we are not confused in yellow and red cells. The only possible situation that F and S has that conversation is that both of them has $6^6$.
Mission accomplished.
As the OP noted I took $(x,y)$ different than $(y,x)$, if not there would be multiple solutions. To see the solutions color yellow cells to green.