Plz help in triple sort question from may long challenge 2020. problem code:TRPLSRT

help in triple sort question from code chef long challenge of may 2020
https://www.codechef.com/viewsolution/32992756