Multi-stage Optimization of Matchings in Trees