Trade and the structure of cities