#include using namespace std; int main(){ string s1,s2,s3; string t1,t2,t3; cin>>s1>>s2>>s3>>t1>>t2>>t3; if(s2==t2)cout<<-1<t2?s1:t1)<t2.size()?s1:t1)<