You are given a permutation p of integers from 0 to n - 1 (not initially sorted).
You may swap p_i and p_j if p_i & p_j = X. Find the maximum X such that p is X-sortable.
Constraints: 1 <= t <= 10^4, 2 <= n <= 210^5, sum(n) <= 210^5, 0 <= p_i <= n - 1.