Universal terms for pseudo-complemented distributive lattices and Heyting algebras