Circumgalactic environments around distant quasars 3C 9 and 4C 05.84