public static int connect(int a[], int al, int ar, int b[], int bl, int br)
	{
		int max = 0;
		for (int i = al; i <= ar; i++)
		{
			int j = find(b, bl, br, a[i]);
			if (j == -1)
				continue;
			int n = 0;
			if (i - 1 >= 0 && j - 1 >= 0)
				n += connect(a, al, i - 1, b, bl, j - 1);
			if (i + 1 < a.length && j + 1 < b.length)
				n += connect(a, i + 1, ar, b, j + 1, br);
			if (max < n + 1)
				max = n + 1;
		}
		return max;
	}