D. Beautiful Pairs of Numbers time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The sequence of integer pairs (a1, b1), (a2, b2), ..., (ak, bk) is beautiful, if the following statements are…