# include<iostream>
using namespace std;
int main()
{
int y, m, d, y1, m1, d1;
cin >> y >> m >> d;
cin >> y1 >> m1 >> d1;
if (y1 - y > 0)
cout << "yes";
else if(y1-y==0)
{
if (m1 - m >= 0)
{
if (d1 - d >= 0)
{
cout << "yes";
}
else cout << "no";
}
else cout << "no";
}
else cout << "no";
return 0;
}