XYZ ENCRYPTION doubt

if x and z are not connected , then there are at max 2 connected component here because if they are same then it will go to x or in z and if y is connected to both x and z then it will form one connected component. plz give me an example where connected component is greater then 2 but it form valid string.

For more than one connected component answer is No

ok but but how to solve it i m unable to find any logic.?

First find to elements n graph which are not connected. assign x and z to these elements. and y to another element. Now check the remaining elements.