  The Rainich problem for the Killing-Yano tensors posed by Collinson
\cite{col} is solved. In intermediate steps, we first obtain the necessary and
sufficient conditions for a 2+2 almost-product structure to determine the
principal 2--planes of a skew-symmetric Killing-Yano tensor and then we give
the additional conditions on a symmetric Killing tensor for it to be the square
of a Killing-Yano tensor.We also analyze a similar problem for the conformal
Killing-Yano and the conformal Killing tensors. Our results show that, in both
cases, the principal 2--planes define a maxwellian structure. The associated
Maxwell fields are obtained and we outline how this approach is of interest in
studying the spacetimes that admit these kind of first integrals of the
geodesic equation.
