#include <bits/stdc++.h>
using namespace std;
typedef string::const_iterator State;
const int MOD=1000000007;
const int INF=1000000000;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;
ll p=0;
bool zerodiv=false;
string t;
set<int> A;
set<int> B;
set<int> C;
set<int> D;
set<int> E;
set<int> U;

// 和集合の計算
template<class T>  set<T> Union(const set<T>& rsettA, const set<T>&rsettB) {
    set<T> settUnion(rsettA);
    for (typename set<T>::iterator itt = rsettB.begin(); itt != rsettB.end(); itt++) {
        settUnion.insert(*itt);
    }
    return settUnion;
}
// 積集合の計算
template<class T>  set<T> Product(const set<T>& rsettA,const set<T>&rsettB) {
    set<T> settProduct;
    for (typename set<T>::iterator itt = rsettB.begin(); itt != rsettB.end(); itt++) {
        if (rsettA.find(*itt) != rsettA.end()) {
            settProduct.insert(*itt);
        }
    }
    return settProduct;
}

// 補集合の計算
template<class T>  set<T> Complement(const set<T>& rsettA,const set<T>&rsettB) {
    set<T> settComplement(rsettA);
    for (typename set<T>::iterator itt = rsettB.begin(); itt != rsettB.end(); itt++) {
        settComplement.erase(*itt);
    }
    return settComplement;
}

//symmetric differenceの計算
template<class T>  set<T> Symmetric(const set<T>& rsettA,const set<T>&rsettB) {
    return Union(Complement(rsettA,rsettB),Complement(rsettB,rsettA));
}

class Parser{
public:
    set<int> pars(State &begin,State &end){
        set<int> ret;
        while(begin<end){
            ret=expression(begin);
            ++begin;
        }
        return ret;
    }
    set<int> number(State &begin)
    {
        set<int> ret;
        while(int(*begin-'a')<0)
        {
            if(*begin=='A')
            {
                return A;
            }
            else if(*begin=='B')
            {
                return B;
            }
            else if(*begin=='C')
            {
                return C;
            }
            else if(*begin=='D')
            {
                return D;
            }
            else if(*begin=='E')
            {
                return E;
            }
        }
        return ret;
    }

    set<int> expression(State &begin)
    {
        set<int> ret;
        ret=factor(begin);
        ++begin;
        while(true){
            if(*begin=='u')
            {
                begin++;
                ret=Union(ret,factor(begin));
                ++begin;
            }
            else if(*begin=='i')
            {
                begin++;
                ret=Product(ret,factor(begin));
                ++begin;
            }
            else if(*begin=='d')
            {
                begin++;
                ret=Complement(ret,factor(begin));
                ++begin;
            }
            else if(*begin=='s')
            {
                begin++;
                ret=Symmetric(ret,factor(begin));
                ++begin;
            }
            else{
                break;
            }
        }
        return ret;
    }

    set<int> factor(State &begin)
    {
        set<int> ret;
        if(*begin=='c'){
            ++begin;
            if(*begin=='(')ret=Complement(U,expression(begin));
            else ret=Complement(U,number(begin));
        }
        else if(*begin=='('){
            ++begin;//skip '('
            ret=expression(begin);
        }
        else ret=number(begin);
        return ret;
    }
};


int main(int argc,char const* argv[])
{
    char setname;
    int setnum;
    string t;
    while(cin)
    {
        A.clear();
        B.clear();
        C.clear();
        D.clear();
        E.clear();
        U.clear();
        while(cin >> setname >> setnum)
        {
            if(setname=='R') break;
            for(int i=0;i<setnum;i++)
            {
                int inum;
                cin >> inum;
                if(setname=='A')
                {
                    A.insert(inum);
                }
                if(setname=='B')
                {
                    B.insert(inum);
                }
                if(setname=='C')
                {
                    C.insert(inum);
                }
                if(setname=='D')
                {
                    D.insert(inum);
                }
                if(setname=='E')
                {
                    E.insert(inum);
                }
            }
        }
        if(!cin)break;
        U=Union(A,B);
        U=Union(U,C);
        U=Union(U,D);
        U=Union(U,E);
        cin >> t;
        Parser ps;
        State begin=t.begin();
        State end=t.end();
        set<int> ans=ps.pars(begin,end);

        int cnt=0;
        for(auto it:ans)
        {
            if(cnt!=0)cout<<' ';
            cout << it;
            ++cnt;
        }
        if(ans.size()==0)cout<<"NULL";
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3212