You should have noticed that the two pendulums take turns to grow and shrink in amplitude. This is because they take turns to be the driver.
The driver always leads the driven by a quarter of a cycle. As driver does positive work on the driven, it passes its energy to the driven. When the driver’s amplitude decays completely, the other pendulum takes over to be the driver, and the cycle continues.