Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use the permutation and combination theory to add one (P, D) pair each time until n pairs.
Solve with full IDE support and test cases