Codechef long challenge problem KS1(Guddu on his mother)

I figured it out how to solve the problem by associativity
property of xor but dont know how to implement it.
I got only 50 points by this.
so many coders implemented it by unordered_map
please tell me how to approach this problem

link - https://www.codechef.com/AUG19B/problems/KS1
solution - https://www.codechef.com/viewsolution/25865451

please reply as fast as possible