The brain treats rejection like physical pain, according to scientists.