  A weighted bicolored plane tree is a bicolored plane tree whose edges are
endowed with positive integral weights. The degree of a vertex is defined as
the sum of the weights of the edges incident to this vertex. Using the theory
of dessins d'enfants, which studies the action of the absolute Galois group on
graphs embedded into Riemann surfaces, we show that a weighted plane tree is a
graphical representation of a pair of coprime complex polynomials A,B such
that: (a) deg A = deg B, and A and B have the same leading coefficient; (b) the
multiplicities of the roots of A (respectively, of B) are equal to the degrees
of the black (respectively, white) vertices of the corresponding tree; (c) the
degree of the difference A-B attains the minimum which is possible for the
given multiplicities of the roots of A and B. Moreover, if a tree in question
is uniquely determined by the set of its black and white vertex degrees (we
call such trees unitrees), then the corresponding polynomials are defined over
Q.
  The pairs of polynomials A,B such that the degree of the difference A-B
attains the minimum, and especially those defined over Q, are related to some
important questions of number theory. Dozens of papers were dedicated to their
study. The main result of this paper is a complete classification of the
unitrees which provides us with the most massive class of such pairs defined
over Q. We also study combinatorial invariants of the Galois action on trees,
as well as on the corresponding polynomial pairs, which permit us to find yet
more examples defined over Q. In a subsequent paper we compute the polynomials
A,B corresponding to all the unitrees.
