public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		StringBuilder out = new StringBuilder();
		while ((line = in.readLine()) != null && line.length() != 0) {
			int nSet = Integer.parseInt(line.trim());
			for (int i = 0; i < nSet; i++) {
				int[] nm = readInts(in.readLine());
				int n = nm[0];
				int m = nm[1];
				WeightedQuickUnionUF wqu = new WeightedQuickUnionUF(n + 1);
				owe = new int[n + 1];
				total = new int[n + 1];
				for (int j = 0; j < n; j++)
					owe[j] = Integer.parseInt(in.readLine().trim());
				int a, b;
				for (int j = 0; j < m; j++) {
					int[] ab = readInts(in.readLine());
					a = ab[0];
					b = ab[1];
					wqu.union(a, b);
				}
				for (int j = 0; j <= n; j++)
					total[wqu.find(j)] += owe[j];
				boolean pos = true;
				for (int j = 0; j < total.length; j++)
					if (total[j] != 0) {
						pos = false;
						break;
					}
				out.append((!pos ? "IM" : "") + "POSSIBLE\n");
			}
		}
		System.out.print(out);
	}