A leader of a tree T on [n] is a vertex which has no smaller descendants in T. Gessel and Seo showed that Sigma(T is an element of Tn) u(C)((# of leaders in T))((degree of 1 in T)) = uP(n-1)(1, u, cu), which is a generalization of Cayley's formula, where T-n is the set of trees on [n] and P-n(a, b, c) = c(n-1)Pi(i=1)(ia+(n-i)b+c). Using a variation of the Prufer code which is called a RP-code, we give a simple bijective proof of Gessel and Seo's formula. (C) 2007 Elsevier Inc. All rights reserved.