There are 5 caps and 3 colours. ∴ At least one colour will get repeated. As adjacent caps should be of different colours, no colour can repeat thrice. ∴ Exactly two colours will repeat twice. ∴ Colour of the caps are selected in 3 ways as follows: Red-Red-Green-Green-Blue, Red-Red-Green-Blue-Blue, Red-Green-Green-Blue-Blue. Now, while distributing the caps from above combinations, we choose any one of the 5 persons and give single colour cap. And remaining four caps can be distributed in alternate colour sequence, clock-wise or anticlock-wise. This can be done in 5×2 ways. ∴ Required number of ways =3×5×2=30.