#define mk make_pair constint N = 1e6 + 10; constint mod = 1e9 + 7;
ll read() { ll x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + c - '0', c = getchar(); return x * f; } int rt[N]; structTri { int scnt, ch[N * 33][2], cnt[N * 33]; int q[N * 32]; voidinsert(int &pos, int pre, ll x, int id) { pos = ++scnt; int tmp = pos; cnt[tmp] = cnt[pre] + 1; for (int i = 32; i >= 0; i--) { int c = (x & (1 << i)) >> i;