#include<cstdio>
#include<map>
#include<string>
#include<climits>
#include<queue>
#include<iostream>
#include<cstring>
const int MAXN=2000+5;
const int MAXM=200000+5;
struct Edge{int u,v,next,w;};
std::map<std::string,int>map;
Edge edge[MAXM];int nodecnt,cnt,head[MAXN],dis[MAXN],wei[MAXN];std::string unmap[MAXN];bool vis[MAXN];
std::queue<int>que;
void AddEdge(int u,int v,int w)
{
int &i=++cnt;
edge[i].u=u;edge[i].v=v;edge[i].w=w;
edge[i].next=head[u];head[u]=i;
}
int SPFA(int begin)
{
for(int i=1;i<=nodecnt;i++)
dis[i]=INT_MAX;
dis[begin]=0;
memset(vis,0,sizeof(vis));
que.push(begin);
while(!que.empty())
{
int u=que.front();que.pop();
vis[u]=0;
for(int i=head[u];i;i=edge[i].next)
{
int v=edge[i].v;
if(dis[v]>dis[u]+edge[i].w)
{
dis[v]=dis[u]+edge[i].w;
if(!vis[v])
{
vis[v]=1;
que.push(v);
}
}
}
}
int ans=0;
for(int i=1;i<=nodecnt;i++)
{
if(dis[i]==INT_MAX) return INT_MAX; else ans+=dis[i];
}
return ans;
}
int main()
{
int n,a,b,c;std::string inp;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
std::cin>>inp;
std::cin>>b;
a=map[inp];
if(!a)
{
map[inp]=++nodecnt;
unmap[nodecnt]=inp;
a=nodecnt;
}
wei[a]+=b;
}
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
std::cin>>inp;
a=map[inp];
if(!a) continue;
std::cin>>inp;
b=map[inp];
if(!b) continue;
c=wei[a]+wei[b];
AddEdge(a,b,c);
AddEdge(b,a,c);
}
int r1=0,r2=0;int id;
for(int i=1;i<=nodecnt;i++)
{
c=SPFA(i);
if(c==INT_MAX) goto err;
if(r1<c) {r1=c;id=i;continue;}
if(r2<c) r2=c;
}
if(r1==r2) goto err;
printf("The ONLY truth is: it is you, ");
std::cout<<unmap[id];
return 0;
err:
printf("The ONLY truth is: it is you, 222.240.168.135");
return 0;
}