Reactions of polyhydric phenols with nitrogen-containing acetals in the synthesis of polyphenols and heterocyclic compounds