// No.138 化石のバージョン
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var s1, s2 string
	fmt.Scan(&s1, &s2)
	x1 := strings.SplitN(s1, ".", 3)
	a0, _ := strconv.Atoi(x1[0])
	b0, _ := strconv.Atoi(x1[1])
	c0, _ := strconv.Atoi(x1[2])

	x2 := strings.SplitN(s2, ".", 3)
	a1, _ := strconv.Atoi(x2[0])
	b1, _ := strconv.Atoi(x2[1])
	c1, _ := strconv.Atoi(x2[2])

	if a1 <= a0 && b1 <= b0 && c1 <= c0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}