  We give a necessary and sufficient condition for a map defined on a
simply-connected quasiconvex metric space to factor through a tree. In case the
target is the Euclidean plane and the map is H\"older continuous with exponent
bigger than 1/2, such maps can be characterized by the vanishing of some
integrals over the winding number function. This in particular shows that if
the target is the Heisenberg group equipped with the Carnot-Carath\'eodory
metric and the H\"older exponent of the map is bigger than 2/3, the map factors
through a tree.
