During a family party, Mr and Mrs Tan distributed four party hats to their four children. The hats came in four different colours, each of which is liked by one of their four children. Charles was supposed to wear the yellow hat, Darius the blue one, Brenda the red one and Alfred the green hat.
Unfortunately, Mr Tan made a blunder in distributing the party hats. Mrs Tan scolded him, saying that none of the four kids have a party hat of their favourite colour.
Each of the four kids could only see their own hat. Just then, Charles told Darius, "My hat is not X." X is a colour which is neither yellow nor the colour of the hat Darius received. Only Charles and Darius knew what X is. This alone was enough for the two older brothers to figure out what colour hats the four kids were given.
What was the colour of the hat Charles received?