1.
Let the number of elements of the sets A and B be p and q, respectively. Then, the number of relations from the set A to the set B is