When $f(x) = g(y)$ for almost every $(x,y)$, must $f$ and $g$ be constant almost everywhere? Consider two measure spaces $(X,\mathcal{A},\mu)$ and $(Y,\mathcal{B},\nu)$, where $\mu\times\nu(X\times Y)>0$. Given two measurable functions $f:X\to \mathbb{R}$ and $g:Y\to\mathbb{R}$ such that 
$$f(x) = g(y)   \qquad\mu\times\nu \,\,\text{a.e,}$$
does it follow that there exists a constant $\lambda$ such that $f(x)=\lambda$ for $\mu$-a.e. $x$ and $g(y)=\lambda$ for $\nu$-a.e. $y$?
Clarification: The displayed statement means that $\mu\times\nu\big(\{(x,y):f(x)\neq g(y)\}\big)=0$.
I know that this is true when you assume $\mu$ and $\nu$ are $\sigma$-finite, by applying Fubini's theorem to $\int |f(x)-g(y)|\,d(\mu\times\nu)$. In the general case, the only first step I can think of is to find a countable set of rectangles with arbitrarily small total area where $f(x)=g(y)$ on the complement of their union. But there I'm stuck.
 A: Ok, after a year of struggling with this I finally think I have an answer! Figured I should post for whoever else is curious: it does follows that $f,g=\lambda$ a.e. for some $\lambda$.
First off, without loss of generality we can assume $f(x),g(y)\in[0,1]$ for all $x,y$. If not, just compose them with $h(s)=\frac{\tan^{-1}(s)+\pi/2}{\pi}$; since $h$ is injective, $h\circ f=$ constant a.e. implies $f=$ constant a.e.
Let $$B_{n,b}=\{x\in[0,1]:\text{the nth binary digit of x is } b\},$$ for $b=0,1$, $n\ge1$. Let $F_{n,b} = f^{-1}(B_{n,b})$ and $G_{n,b} = g^{-1}(B_{n,b})$. 
Claim: For each $n$, we have either $F_{n,0}\times G_{n,0}$ is full measure, or $F_{n,1}\times G_{n,1}$ is full measure. To see this, first note that both $\mu\times\nu(F_{n,0}\times G_{n,1})$ and $\mu\times\nu(F_{n,1}\times G_{n,0})$ are zero since they are subsets of $\{f(x)\neq g(y)\}$. These, combined with $F_{n,0}+F_{n,1}=\mu(X)>0$ and $G_{n,0}+G_{n,1}>0$, show that
 $$
\mu(F_{n,0})>0\implies \nu(G_{n,1})=0\implies \nu(G_{n,0})>0\implies \mu(F_{n,1})=0
$$
and 
$$
\mu(F_{n,0})=0\implies \mu(F_{n,1})>0\implies \nu(G_{n,0})=0.
$$
Thus, either both $F_{n,0}$ and $G_{n,0}$ are full measure, or both $F_{n,1}$ and $G_{n,1}$ are, proving my claim.
Let $b_n$ be the bit for which $F_{n,b_n}\times G_{n,b_n}$ is full measure. Then $$\bigcap_{n\ge 1}F_{n,b_n}\times G_{n,b_n}=\left(\bigcap_{n\ge 1}F_{n,b_n}\right)\times \left(\bigcap_{n\ge1}G_{n,b_n}\right)$$ will have full measure as well, implying both $\bigcap_{n\ge 1}F_{n,b_n}$ and $\bigcap_{n\ge 1}G_{n,b_n}$ are full measure. But these are precisely $f^{-1}(\lambda)$ and $g^{-1}(\lambda)$, where the $n^{th}$ binary digit of $\lambda$ is $b_n$. Thus, both $f^{-1}(\lambda)$ and $g^{-1}(\lambda)$ have full measure, so $f(x)=\lambda$ a.e. and $g(y) = \lambda$ a.e, with respect to $\mu,\nu$.
If this proof is wrong/needs clarification, please comment!
A: I have a counterexample.
Let $X=Y=\lbrace \ast,\#\rbrace$ with $\mathcal M=\mathcal N=\wp(X)$. Define $\mu$ on $\mathcal M$ by setting $\mu(\ast)=0$ and $\mu(\#)=\infty$ and $\nu$ by switching the roles of the two values taken by   $\mu$, i.e. $\nu(\ast)=\infty$ and $\nu(\#)=0$. Let $f=g\colon X=Y\longrightarrow \mathbb R$ be the measurable function defined by $f(\ast)=0$ and $f(\#)=1$.
We have $f=1$ $\mu$-a.e. and $g=0$ $\nu$-a.e.
