#include #include #include #include #include #include #include #include using namespace std; const int MAX= 10000100; #define loop(i,a,b) for(int i = a ; i < b ; i ++) #define rep(i,a) loop(i,0,a) #define all(a) (a).begin(),(a).end() #define ll long long int #define gcd(a,b) __gcd(a,b) int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);} int lcm(int a, int b) {return a*b / gcd(a, b);} int main(void){ char ina[1000],inb[1000]; cin>>ina>>inb; int a,b,c; int d,e,f; sscanf(ina,"%d.%d.%d",&a,&b,&c); sscanf(inb,"%d.%d.%d",&d,&e,&f); if(a>d)cout<<"YES"; else if(a>d&&b>e)cout<<"YES"; else if(a>=d&&b>=e&&c>=f)cout<<"YES"; else cout<<"NO"; cout<