The horse's position on the ground at time t is
x = (20 m/s) t
The baboon's height from the ground at time t is
y = 3 m - 1/2 g t²
where g = 9.80 m/s² is the magnitude of the acceleration due to gravity.
The baboon falls and lands on the horse, so that the two animals meet when the baboon's height is 2 m from the ground, which happens after
2 m = 3 m - 1/2 g t²
1/2 g t² = 1 m
t² = (2 m) / (9.80 m/s²)
t ≈ 0.452 s
In this time, the horse reaches the tree, so its distance from it is
(20 m/s) * (0.452 s) ≈ 9.04 m