Maximal Intersection

CodeForces - 1029C