Bees and ants 'operate in teams'