Let $X,Y$ and $Z$ be standard Borel spaces: topological spaces homeomorphic to Borel subsets of complete separable metric spaces. Let $K\subseteq X\times Y$ be analytic. Assume that $K_x$ is not empty for any $x\in X$ where $$ K_x := \{y\in Y:(x,y)\in K\} $$ is the $x$-section of $K$ (that is, $K$ has a full projection onto $X$). Consider the following diagram:

Suppose that $g$ is a Borel map, and $h$ is an analytically measurable map with a property that $$ h(x) \in g(x,K_x)\qquad \forall x\in X \tag{$\star$} $$ I wonder whether there does exist a map $f:X\to Y$ satisfying the following properties:

the diagram commutes: $g(x,f(x)) = h(x)$ for all $x\in X$,

it holds that $(\mathrm{id}_X,f)(X) \subseteq K$ or equivalently $\mathsf{Gr}[g]\subseteq K$ where the graph of $f$ is $$ \mathsf{Gr}[f]:=\{(x,f(x)):x\in X\}\subseteq X\times Y. $$

$f$ is analytically measurable.

Note that if we consider a set $A\subseteq X\times Y$ defined by $$ A:=\{(x,y):g(x,y) = h(x)\}, $$ then conditions 1,2 together are equivalent to the statement that $\mathsf{Gr}[f]\subseteq A\times K$. Note that $(\star)$ implies that $A_x\neq\emptyset$ and thus conditions 1 and 2 can be always satisfied. The question is thus whether it is possible to satisfy an additional condition 3.

**Some thoughts.** Note also that
$$
A = \{(x,y): d_Z(g(x,y),h(x)) = 0\} \tag{$\star\star$}
$$
where $d_Z$ is any metric compatible with the topology of $Z$. If we are able to show that $A$ is analytical, then $A\cap K$ is analytical as well and hence contains a graph of an analytical map. However, from $(\star\star)$ it only follows that $A$ is analytically measurable.