Segregation and school attainment