Two hydrocarbons X and Y were treated with bromine water. X decolorised the solution and…