# -*- coding:utf-8 -*- # http://yukicoder.me/problems/341 if __name__ == '__main__': version_int = lambda a, b, c: int("{:0>3}{:0>3}{:0>3}".format(*map(int, (a, b, c)))) print("YES" if version_int(*input().split(".")) >= version_int(*input().split(".")) else "NO")