Local and nonlocal thermopower in three-terminal nanostructures