Variational characterization of multitype Galton-Watson branching processes