#include <stdio.h>

int main() {
	int y = 0, m = 0, d = 0, y1 = 0, m1 = 0, d1 = 0;
	scanf("%d%d%d%d%d%d", &y, &m, &d, &y1, &m1, &d1);
	if (y1 > y)
		printf("yes");
	else if (y1 == y) 
    {
		if (m1 > m)
			printf("yes");
		else if (m1 == m) 
        {
			if (d1 >= d)
				printf("yes");
			else
				printf("no");
		}
		else
			printf("no");
	}
	else
		printf("no");

	return 0;
}