Reaction products of polyamines with aldehydes or ketones