Arranging Hat

Problem Name:
Arranging Hat
Site:CodeForces
Links:
Tags:
Problem setters: