#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;

// 構文解析
using State = string::const_iterator;
class ParseError{};

map<char, vector<int>> st;

void comp(vector<int> &v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
}

vector<int> op_u(vector<int> A, vector<int> B) {
    vector<int> ret;
    set_union(A.begin(), A.end(), B.begin(), B.end(), back_inserter(ret));
    return ret;
}

vector<int> op_i(vector<int> A, vector<int> B) {
    vector<int> ret;
    set_intersection(A.begin(), A.end(), B.begin(), B.end(), back_inserter(ret));
    return ret;
}

vector<int> op_d(vector<int> A, vector<int> B) {
    vector<int> ret;
    set_difference(A.begin(), A.end(), B.begin(), B.end(), back_inserter(ret));
    return ret;
}

vector<int> op_s(vector<int> A, vector<int> B) {
    vector<int> ret;
    set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), back_inserter(ret));
    return ret;
}

vector<int> op_c(vector<int> A) {
    vector<int> ret;
    set_symmetric_difference(st['U'].begin(), st['U'].end(), A.begin(), A.end(), back_inserter(ret));
    return ret;
}

vector<int> term(State &begin);
vector<int> factor(State &begin);
vector<int> expression(State &begin);

// 乗算除算の式をパースして，その評価結果を返す
vector<int> term(State &begin) {
    if (*begin == 'c') {
        begin++;
        return op_c(factor(begin));
    }
    else {
        return factor(begin);
    }
}

vector<int> factor(State &begin) {
    if (*begin == '(') {
        begin++;
        vector<int> ret = expression(begin);
        begin++;
        return ret;
    }
    else {
        return st[*begin++];
    }
}

vector<int> expression(State &begin) {
    vector<int> ret = term(begin);

    for (;;) {
        if (*begin == 'u') {
            begin++;
            ret = op_u(ret, term(begin));
        }
        else if (*begin == 'i') {
            begin++;
            ret = op_i(ret, term(begin));
        }
        else if (*begin == 'd') {
            begin++;
            ret = op_d(ret, term(begin));
        }
        else if (*begin == 's') {
            begin++;
            ret = op_s(ret, term(begin));
        }
        else {
            break;
        }
    }

    return ret;
}

int main() {
    while (true) {
        st.clear();
        char ch;
        int n;
        bool ok = false;
        while (cin >> ch >> n) {
            ok = true;
            if (ch == 'R' and n == 0) break;
            int a;
            rep(i, n) {
                cin >> a;
                st['U'].emplace_back(a);
                st[ch].emplace_back(a);
            }
        }

        comp(st['U']);
        if (!ok) break;
        for (auto & s : st) comp(s.second);

        cin.ignore();
        string s;
        getline(cin, s);
        State begin = s.begin();
        vector<int> ans = expression(begin);
        if (ans.size() == 0) cout << "NULL" << endl;
        else {
            rep (i, ans.size()) {
                if (i) cout << " ";
                cout << ans[i];
            }
            cout << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3008