Ok , Here is what I've tried to do ,
the the function with max. no. of elements from these 2 sets should be a many-one on-to function right ? The no. of elements in that set(function) should be p*q(if the no of elements in 1st set is p and 2nd is q) , and i think that all other functions from these 2 sets should be subsets of this.
Considering this as a relation (and not a function) the no. subsets should be 2^mn . but for this relation to be a function there should be all the elements of set X in the ordered pairs which are the elements of the relation .
But using this logic and using cobinations I can't seem to get to the result q^p