Maximum xor query

This is a practice question I was solving : https://www.codechef.com/problems/MCO16404

Here i was trying to build trie for each segment i.e. for each segment of the array . But I am not able to understand how to merge the tries from two child nodes. Or is there any better way to solve the problem . Please help me. I referred the editorial also but they have explained the almost similar way I am doing. Kindly help me in the step of merging two child’s tries or is there any better way ?