#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FO(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FOD(i,a,b) for(int i=a;i>b;i--)
#define FORV(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end(); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
#define maxn 200005
int n, m, u, v;
vector<int> adj[maxn];
int cnt[maxn];
bool color[maxn];
int find2(){
int ok = rand()%2;
if(ok == 1){
FOR(u,1,n){
if(cnt[u] > 2) return u;
}
}
else{
FORD(u,n,1){
if(cnt[u] > 2) return u;
}
}
return 0;
}
void update(int u){
int tmp = 0;
FO(i,0,adj[u].size()){
int v = adj[u][i];
if(color[u] == color[v]) cnt[v]--;
else{
cnt[v]++;
tmp++;
}
}
cnt[u] = tmp;
color[u] = !color[u];
}
void solve(){
FOR(u,1,n)
if(rand()%2) color[u] = 1;
else color[u] = 0;
FOR(u,1,n){
FO(i,0,adj[u].size()){
int v = adj[u][i];
if(color[u] == color[v]) cnt[u]++;
}
}
while(1){
int pos = find2();
if(pos == 0) break;
update(pos);
}
FOR(i,1,n){
if(color[i] == 1) cout << "A";
else cout << "B";
}
cout << endl;
}
int main() {
srand(time(0));
ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
//freopen("test.in", "r", stdin);
//freopen("test.out", "w", stdout);
#endif
cin >> n;
FOR(k,1,5){
cin >> m;
while(m--){
cin >> u >> v;
adj[u].pb(v);
adj[v].pb(u);
}
}
solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgTEwgbG9uZyBsb25nCiNkZWZpbmUgVUxMIHVuc2lnbmVkIGxvbmcgbG9uZwojZGVmaW5lIEZPUihpLGEsYikgZm9yKGludCBpPWE7aTw9YjtpKyspCiNkZWZpbmUgRk8oaSxhLGIpIGZvcihpbnQgaT1hO2k8YjtpKyspC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CiAgICBGT1IodSwxLG4pCiAgICAgICAgaWYocmFuZCgpJTIpIGNvbG9yW3VdID0gMTsKICAgICAgICBlbHNlIGNvbG9yW3VdID0gMDsKICAgIEZPUih1LDEsbil7CiAgICAgICAgRk8oaSwwLGFkalt1XS5zaXplKCkpewogICAgICAgICAgICBpbnQgdiA9IGFkalt1XVtpXTsKICAgICAgICAgICAgaWYoY29sb3JbdV0gPT0gY29sb3Jbdl0pIGNudFt1XSsrOwogICAgICAgIH0KICAgIH0KCiAgICB3aGlsZSgxKXsKICAgICAgICBpbnQgcG9zID0gZmluZDIoKTsKICAgICAgICBpZihwb3MgPT0gMCkgYnJlYWs7CiAgICAgICAgdXBkYXRlKHBvcyk7CiAgICB9CiAgICBGT1IoaSwxLG4pewogICAgICAgIGlmKGNvbG9yW2ldID09IDEpIGNvdXQgPDwgIkEiOwogICAgICAgIGVsc2UgY291dCA8PCAiQiI7CiAgICB9CiAgICBjb3V0IDw8IGVuZGw7Cn0KCgppbnQgbWFpbigpIHsKICAgIHNyYW5kKHRpbWUoMCkpOwogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgI2lmbmRlZiBPTkxJTkVfSlVER0UKICAgIC8vZnJlb3BlbigidGVzdC5pbiIsICJyIiwgc3RkaW4pOwogICAgLy9mcmVvcGVuKCJ0ZXN0Lm91dCIsICJ3Iiwgc3Rkb3V0KTsKICAgICNlbmRpZgogICAgY2luID4+IG47CiAgICBGT1IoaywxLDUpewogICAgICAgIGNpbiA+PiBtOwogICAgICAgIHdoaWxlKG0tLSl7CiAgICAgICAgICAgIGNpbiA+PiB1ID4+IHY7CiAgICAgICAgICAgIGFkalt1XS5wYih2KTsKICAgICAgICAgICAgYWRqW3ZdLnBiKHUpOwogICAgICAgIH0KICAgIH0KICAgIHNvbHZlKCk7CgoKICAgIHJldHVybiAwOwp9Cg==