// ━━━━━━神兽出没━━━━━━ // ━━━━ mythical creatures ━━ // ┏┓ ┏┓ // ┏┛┻━━━━━━━┛┻┓ // ┃ ┃ // ┃ ━ ┃ // ━ ┃ // ┃ ┃ // ┃ ┻ ┃ // ┃ ┃ // ┗━┓ ┏━┛ // ┃ ┃ // ┃ ┃ // ┃ ┗━━━┓ // ┃ ┣┓ // ┃ ┏┛ // ┗┓┓┏━━━━━┳┓┏┛ // ┃┫┫ ┃┫┫ // ┗┻┛ ┗┻┛ // // ━━━━━━感觉萌萌哒━━━━━━ // ━━━━━━feel lovely━━━━━ // Author : lkdmhy #pragma comment(linker, "/STACK:1677721600") #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define pf printf #define sf scanf #define INF 0x3f3f3f3f #define mem0(a) memset(a,0,sizeof(a)) #define mem_1(a) memset(a,-1,sizeof(a)) #define FIN freopen("in.txt", "r", stdin) #define FOUT freopen("out.txt", "w", stdout) template inline bool in(T &ret) { char c; int sgn; if (c=getchar(),c==EOF) return 0; while (c!='-'&&(c<'0'||c>'9')) c=getchar(); sgn=(c=='-')?-1:1; ret=(c=='-')?0:(c-'0'); while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0'); ret*=sgn; return 1; } template inline void out(T x) { if(x<0){ putchar('-'); x=-x; } if(x>9) out(x/10); putchar(x%10+'0'); } template T MAX(T a, T b) { return a > b ? a : b; } template T MIN(T a, T b) { return a < b ? a : b; } template T GCD(T a, T b) { return b ? GCD(b, a%b) : a; } template T LCM(T a, T b) { return a / GCD(a,b) * b; } typedef long long LL; typedef unsigned long long ULL; const int MAXN = 1000000 + 10; const int MAXM = 50 + 10; const double eps = 1e-8; int main(){ int T; cin>>T; int a,b,c; int a1[30],b1[30],c1[30]; while(T--){ mem0(a1),mem0(b1),mem0(c1); cin>>a>>b>>c; char x; int t; for(int i=1;i<=a;i++){ cin>>x>>t; a1[x-'A'+1]=t; } for(int i=1;i<=b;i++){ cin>>x>>t; b1[x-'A'+1]=t; } for(int i=1;i<=c;i++){ cin>>x>>t; c1[x-'A'+1]=t; } //for(int i=0;i<=27;i++) cout<