#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;

vi S[6];
string expr;

vi calc(vi a,vi b,char op)
{
	vi ret(a.size()+b.size());
	vi::iterator it;
	switch(op)
	{
	case 'u':
		it=set_union(all(a),all(b),ret.begin()); break;
	case 'i':
		it=set_intersection(all(a),all(b),ret.begin()); break;
	case 'd':
		it=set_difference(all(a),all(b),ret.begin()); break;
	case 's':
		it=set_symmetric_difference(all(a),all(b),ret.begin()); break;
	}
	ret.erase(it,ret.end());
	return ret;
}

vi eval(int s,int t)
{
	int d=0,p=t-1; char c;
	for(;p>s;p--)
	{
		c=expr[p];
		if(c=='(')d++;
		if(c==')')d--;
		if(d==0&&(c=='u'||c=='i'||c=='d'||c=='s'))break;
	}
	if(p==s)
	{
		if(expr[s]=='(')return eval(s+1,t-1);
		if(expr[s]=='c')return calc(S[5],eval(s+1,t),'d');
		return S[expr[s]-'A'];
	}
	return calc(eval(s,p),eval(p+1,t),c);
}

int main()
{
	char c; int n;
	while(cin>>c>>n)
	{
		rep(i,6)S[i].clear();
		do
		{
			rep(i,n)
			{
				int t; cin>>t;
				S[c-'A'].pb(t);
				S[5].pb(t);
			}
		}while(cin>>c>>n,c!='R');
		
		rep(i,6)
			sort(all(S[i])),S[i].erase(unique(all(S[i])),S[i].end());
		cin>>expr;
		
		vi ans=eval(0,expr.size());
		if(ans.empty())cout<<"NULL"<<endl;
		else rp(i,ans)cout<<ans[i]<<(i==ans.size()-1?"\n":" ");
	}
	return 0;
}