def solve( lst_a, lst_b,n):
    if n.count("-")>=2:
        return "No"
    else:
        N,NN=n.split("-")
        if lst_a == len(N) and lst_b == len(NN):
            answer = "Yes"
        else:
            answer = "No"
    return answer
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    n = int(line1)
    lst_a = []
    lst_b = []
    for i in range(n):
        line = sys.stdin.readline()
        [str_a, str_b] = line.rstrip().split(' ')
        lst_a.append(int(str_a))
        lst_b.append(int(str_b))
    return (n, lst_a, lst_b)

def main():
    n, lst_a, lst_b = readQuestion()
    answer = solve(n, lst_a, lst_b)
    print(answer)
    
if __name__ == '__main__':
    main()