Let $\mathcal{X}^m, \mathcal{Y}^n,\mathcal{Z}^p$ be manifolds. Let $f : \mathcal{X} \to \mathcal{Z}$ and $g : \mathcal{Y} \to \mathcal{Z}$ be maps such that $f \pitchfork g$. Prove that $$\mathcal{M}=\{(x, y) \in X \times Y : f(x) = g(y)\}$$ is a smooth submanifold of $\mathcal{X} \times \mathcal{Y}$.
It seems what I have attempted is completely wrong...