Mahmoud and Ehab and the bipartiteness

CodeForces - 862B