Vladik and Entertaining Flags

CodeForces - 811E