Problem 6: Decorate Christmas Tree II (0 pts)

This time, Isla bought 3 super big Christmas trees, which all have more than 30000 nodes! Can you still work out in less than 5 seconds?

Hint1: You should scan every node only constant times.

Hint2: You can set up new attribute of Tree instance in your solution to memorize something! It doesn't violate abstraction barrier.