How do bees from a hive distinguish bees that belong to another one?

The size

The smell

The legs

The color