#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define dump(a) (cerr << (#a) << " = " << (a) << endl)
#define FOR(it,c) for(__typeof((c).begin())it=(c).begin(); it!=(c).end();++it)
#define RFOR(it,c) for(__typeof((c).rbegin())it=(c).rbegin(); it!=(c).rend();++it)
#define exist(c, v) (find((c).begin(), (c).end(), (v)) != (c).end())

template<class T> inline void chmax(T& a, const T& b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << '(' << p.first << ", " << p.second << ')';
	return os;
}

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
	return os;
}

int idx;
string str;
set<int> u;

set<int> calc_union(const set<int>& a, const set<int>& b) {
	set<int> res(a);
	res.insert(b.begin(), b.end());
	return res;
}

set<int> calc_intersection(const set<int>& a, const set<int>& b) {
	set<int> res;
	set<int>::const_iterator it, en = a.end(), en2 = b.end();
	for(it = a.begin(); it != en; ++it)
		if(b.find(*it) != en2)
			res.insert(*it);

	return res;
}

set<int> calc_difference(const set<int>& a, const set<int>& b) {
	set<int> res;
	set<int>::const_iterator it, en = a.end(), en2 = b.end();
	for(it = a.begin(); it != en; ++it)
		if(b.find(*it) == en2)
			res.insert(*it);

	return res;
}

set<int> calc_symmetric_difference(const set<int>& a, const set<int>& b) {
	return calc_union(calc_difference(a, b), calc_difference(b, a));
}

set<int> complement(const set<int>& a) {
	return calc_difference(u, a);
}

set<int> s[128];
set<int> (*func[128])(const set<int>&, const set<int>&);

set<int> expr();

set<int> fact() {
	if(str[idx] == '(') {
		++idx;
		const set<int> res = expr();
		++idx;
		return res;
	}
	else
		return s[str[idx++]];	
}

set<int> term() {
	if(str[idx] == 'c') {
		++idx;
		return complement(fact());
	}
	else
		return fact();
}

set<int> expr() {
	set<int> res = term();
	while(str[idx] == 'u' || str[idx] == 'i' || str[idx] == 'd' || str[idx] == 's') {
		const char tmp = str[idx++];
		res = func[tmp](res, term());
	}

	return res;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	func['u'] = calc_union;
	func['i'] = calc_intersection;
	func['d'] = calc_difference;
	func['s'] = calc_symmetric_difference;

	while(true) {
		u.clear();
		for(int i = 'A'; i <= 'E'; ++i)
			s[i].clear();

		char c;
		int num;
		while(true) {
			if(!(cin >> c >> num))
				return EXIT_SUCCESS;

			if(c == 'R')
				break;

			while(num--) {
				int element;
				cin >> element;
				s[c].insert(element);
				u.insert(element);
			}
		}

		idx = 0;
		cin >> str;

		const set<int> ans = expr();
		set<int>::const_iterator it = ans.begin(), en = ans.end();
		if(ans.size()) {
			while(true) {
				cout << (*it);
				if(++it == en) {
					cout << endl;
					break;
				}
				else {
					cout << " ";
				}
			}
		}
		else {
			cout << "NULL" << endl;
		}
	}
}

Measured memory_bytes: 1232