Impact of groundwater nitrogen legacy on water quality