Migdal-Kadanoff recursion relations in SU(2) and SU(3) gauge theories