The only natural numbers in the range 1-9 that have the same units digit when raised to their own power are

4^4 = 256

6^6 = 46,656

8^8 = 16,777,216

From these 3 digits, 6 ordered pairs can be formed.

(4, 6), (4, 8), (6, 8), (6, 4), (8, 4), (8, 6)

You can add 3 more pairs if P is allowed to be equal to Q.

(4, 4), (6, 6), (8, 8)

4^4 = 256

6^6 = 46,656

8^8 = 16,777,216

From these 3 digits, 6 ordered pairs can be formed.

(4, 6), (4, 8), (6, 8), (6, 4), (8, 4), (8, 6)

You can add 3 more pairs if P is allowed to be equal to Q.

(4, 4), (6, 6), (8, 8)