PermuTree (hard version)

Problem Name:
PermuTree (hard version)
Site:CodeForces
Links:
Tags:
Problem setters: