import sequtils,strutils var A = stdin.readline.split('.').map(parseInt) B = stdin.readline.split('.').map(parseInt) block main: for i in 0..2: if A[i] < B[i]: echo "NO" break main elif A[i] > B[i]: echo "YES" break main echo "YES"