#include <stdio.h>
#include <stdlib.h>
#include <alloc.h>
#include <ctype.h>
int main() {
  int n, T, first = 0, second = 0;
  char *str1, *str2, *p;
  printf("enter the max length:");
  scanf("%d", &n);
  if(
      ((str1 = (char *)malloc(n + 1)) == NULL) ||
      ((str2 = (char *)malloc(n + 1)) == NULL)
    )
  {
    printf("cannot allocate memory"); exit(-1);
  }
  fflush(stdin);
  printf("string 1: "); gets(str1);
  printf("string 2: "); gets(str2);
  p = str1;
  do {
    while( *p && !(isdigit(*p)) ) ++p;
    sscanf(p, "%d", &T); first += T;
    while(isdigit(*p)) ++p;
  } while(*p);
  p = str2;
  do {
    while( *p && !(isdigit(*p)) ) ++p;
    sscanf(p, "%d", &T); second = max(second, T);
    while(isdigit(*p)) ++p;
  } while(*p);
  if(second > first) printf("yes");
  else printf("no");
  free(str2);
  free(str1);
  return 0;
}