#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

char c;
string s;
int n;
map<char,set<ll>> m;

void print(set<ll> s){
    cout << "set:";
    for(auto it = s.begin();it != s.end();it++){
        cout << *it << " ";
    }
    cout << endl;
}

set<ll> unite(set<ll> a,set<ll> b){
    set<ll> res = a;
    for(auto it = b.begin();it != b.end();it++)res.insert(*it);
    return res;
}

set<ll> inter(set<ll> a,set<ll> b){
    set<ll> res;
    for(auto it = b.begin();it != b.end();it++){
        if(a.find(*it) != a.end())res.insert(*it);
    }
    return res;
}

set<ll> differ(set<ll> a,set<ll> b){
    set<ll> res;
    for(auto it = a.begin();it != a.end();it++){
        if(b.find(*it) == b.end())res.insert(*it);
    }
    return res;
}

set<ll> symme(set<ll> a,set<ll> b){
    // cout << "a";
    // print(a);
    // cout << "b";
    // print(b);
    set<ll> res;
    set<ll> U = unite(a,b);
    set<ll> I = inter(a,b);
    for(auto it = U.begin();it != U.end();it++){
        if(I.find(*it) == I.end())res.insert(*it);
    } 
    return res;
}

set<ll> comple(set<ll> a){
    set<ll> res;
    for(auto it = m['U'].begin();it != m['U'].end();it++){
        if(a.find(*it) == a.end())res.insert(*it);
    }
    return res;
}

set<ll> term(int &i);
set<ll> expr(int &i);

set<ll> term(int &i){
    // cout << "!term" << i << endl;
    set<ll> res;
    if(s[i] == '('){
        i++;
        res = expr(i);
        i++;
    }
    else if(s[i] >= 'A' && s[i] <= 'E'){
        res =  m[s[i]]; 
        i++;     
    }
    return res;
}

set<ll> expr(int &i){
    // cout << "!expr" << i << endl;
    set<ll> res = term(i);
    while(1){
        // cout << "s[i]" << s[i] << endl;
        if(s[i] == 'u'){
            i++;
            res = unite(res,term(i));
            // print(res);
        }
        else if(s[i] == 'i'){
            i++;
            res = inter(res,term(i));
            // print(res);
        }
        else if(s[i] == 'd'){
            i++;
            res = differ(res,term(i));
            // print(res);
        }
        else if(s[i] == 's'){
            i++;
            res = symme(res,term(i));
            // print(res);
        }
        else if(s[i] == 'c'){
            i++;
            res = comple(term(i));
            // print(res);
        }
        else break;
    }
    return res;
}

int main(){
    while(1){
        m.clear();
        bool f = false;
        while(cin >> c >> n && c != 'R'){
            // cout << "!" << c << " " << n << endl;
            f = true;
            rep(i,n){
                ll num;
                cin >> num;
                m[c].insert(num);
                m['U'].insert(num);
            }
        }
        if(!f)break;

        cin >> s;
        int i = 0;
        set<ll> ans = expr(i);
        // cout << "!!" <<  ans.size() << endl;
        if(ans.size() == 0)cout << "NULL";
        for(auto it = ans.begin();it != ans.end();it++){
            if(it != ans.begin())cout << " ";
            cout << *it;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3100