You can't. Firstly, one must be quite careful in talking about functions whose inputs could range over all sets; I am not an expert in set theory by any means, but I believe we still can refer to functions between proper classes (of which the collection of all sets is an example). Letting $\mathsf{Set}$ denote the class of all sets (in fact it can be given the extra structure of a category, though that doesn't really concern us here, I suppose), we can define the "Cartesian product" function (or rather, functor, if we want to use categories*), $P:\mathsf{Set}\times\mathsf{Set}\to\mathsf{Set}$ by $\text{for any }(A,B)\in\mathsf{Set}\times\mathsf{Set},\quad P(A,B)=A\times B$
and this is the function you are talking about, but certainly any set $X$, not all of whose elements are ordered pairs, will not be in the image of $P$, and therefore there is no inverse function $Q:\mathsf{Set}\to\mathsf{Set}\times\mathsf{Set}$ such that $Q(P(A,B))=(A,B)$ for all $(A,B)\in\mathsf{Set}\times\mathsf{Set}$, because it makes no sense to talk about "the original sets" of the sets $X=\{5,\pi\}$ or $Y=\{\mathbb{Z}\}$, for example, so we cannot define $Q(X)$ or $Q(Y)$.
*talking about a functor would also require defining $P$ on functions; we would do so by $\text{for any }(f,g)\in\text{Hom}_{\mathsf{Set}\times\mathsf{Set}}((A,B),(C,D)),\qquad P(f,g)=A\times B\;\;\xrightarrow{\;\;f\times g\;\;}\;\; C\times D$