#include<bits/stdc++.h>
int main()
{
char c[1001];
std::string s,x,targ;
std::cin>>s>>x;
std::map<char,char> ex,er;
int lens=s.size()-1;
for(int i=0;i<=lens;i++)
{
if(!ex.count(x[i])||(ex.count(x[i])&&ex[x[i]]==s[i]))
{
if(!er.count(s[i])||(er.count(s[i])&&er[s[i]]==x[i])){ex[x[i]]=s[i];er[s[i]]=x[i];}
else{std::cout<<"ERROR";exit(0);}
}
else {std::cout<<"ERROR";exit(0);}
}
std::cin>>targ;int lent=targ.size()-1;
for(int i=0;i<=lent;i++)
if(ex.count(targ[i]))c[i]=ex[targ[i]];
else {std::cout<<"ERROR";exit(0);}
for(int i=0;i<=lent;i++)std::cout<<c[i];
return 0;
}