Early humans survived in a range of extreme environments before global migration, study says