When the given mixture is shaken with 1MHCl, amine get protonated and becomes cation (R2
⊕
N
H2), which does not dissolve in organic solvent but usually dissolve in H2O due to its charge. So, shaking with aqueous HCl willpull amines into the aqueous phase and leave all other compounds in organic layer.