#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream fin("c:\input.txt");
string s1,s2,s3,s,sr;
getline(fin,s1);
getline(fin,s2);
getline(fin,s3);
cin>>s;
for(int i=0;i<s1.length();++i)
{
if(s1[i]==' ')
{
if(sr==s){
cout<<"YES";
return 0;
}
break;
}
else sr=sr+s1[i];
}
sr="";
for(int i=0;i<s2.length();++i)
{
if(s2[i]==' ')
{
if(sr==s){
cout<<"YES";
return 0;
}
break;
}
else sr=sr+s2[i];
}
sr="";
for(int i=0;i<s3.length();++i)
{
if(s3[i]==' ')
{
if(sr==s){
cout<<"YES";
return 0;
}
break;
}
else sr=sr+s3[i];
}
cout<<"NO";
return 0;
}