P17209 "DLESS-6" XOR and Your Problem

Background

You created this problem.

Description

You are given a sequence $a$ of $n$ non-negative integers and $q$ queries. For each query, given $l, r$, find: $$ \max_{l\le i\le j\le r}(a_i\oplus a_j) $$ Here, $\oplus$ denotes the bitwise XOR operation.

Input Format

The first line contains two positive integers $n, q$. The second line contains $n$ non-negative integers, representing the sequence $a$. The next $q$ lines each contain two integers $l, r$, representing one query.

Output Format

For each query, output one number per line, representing the answer.

Explanation/Hint

For all testdata, it is guaranteed that: - $1\le n, q\le 3\cdot 10^5$. - $0\le a_i