When the pendulum A with time period 5T4 completes phase of 2π in 5T4 , the other pendulum B leads by phase π2.
So, after four oscillations of pendulum A i.e., after 5T, pendulum B leads by 2π i.e., they come in phase.
i.e., after 5 oscillations of small pendulum (time taken =5T), they will again come in the same phase.