A sheikh said:
If there are two imams in one mosque, should they be regarded as separate or is one the deputy of the other?
It seems that the second option is correct, that one of them is the deputy of the other and completes (the prayer) on his behalf. Based on this, if two imams pray in the mosque, then these two imams are to be regarded as if there are one imam, so a person should stay until the second imam finishes, because we know that the second one is completing the prayer of the first one.
Majma’ Fataawa Ibn ‘Uthaymeen (14/207).
And Allaah knows best.