#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING

#include <bits/stdc++.h>

using namespace std;
const int N = 500500;
int a[N], deg[N];

int main() {
    int T, n, m;
    scanf("%d", &T);
    while (T--) {
        memset(deg, 0, sizeof(deg));
        scanf("%d%d", &n, &m);
        for (int i = 1; i <= n; i++)
            scanf("%d", a + i);
        for (int i = 1, u, v; i <= m; i++)
            scanf("%d%d", &u, &v), deg[u]++, deg[v]++;
        int cnt2[2] = {0};
        for (int i = 1; i <= n; i++)
            cnt2[deg[i] & 1]++;
        if (cnt2[1] == 0) {
            int ans1 = 0;
            for (int i = 1; i <= n; i++)
                if (((deg[i] + 1) / 2) & 1)
                    ans1 ^= a[i];
            int ans2 = 0;
            for (int i = 1; i <= n; i++) ans2 = max(ans2, a[i] ^ ans1);
            printf("%d\n", ans2);
            continue;
        }
        if (cnt2[1] == 2) {
            int ans = 0;
            for (int i = 1; i <= n; i++)
                if (((deg[i] + 1) / 2) & 1)
                    ans ^= a[i];
            printf("%d\n", ans);
            continue;
        }
        puts("Impossible");
    }
    return 0;
}
