Gravar-mail: Acidity and basicity interplay in amide and imide self-association