		for (int K = gi();K--;) A[gi()] = 1;
		for (int K = gi();K--;) B[gi()] = 1;
		scanf("%s",s+1); stack <int> S;
		for (int i = 1;i <= M;++i) match[i] = -1;
		for (int i = 1;i <= M;++i)
		{
			if (s[i] == '(') S.push(i);
			else if (s[i] == ')')
			{
				int t = S.top(); S.pop();
				match[match[t] = i] = t;
			}