N, M = map(int, input().split())
LRD = [tuple(map(int, input().split())) for _ in range(M)]

def consistent(LRD):
    for i, (l1, r1, d1) in enumerate(LRD):
        candl = []
        candr = []
        for j, (l2, r2, d2) in enumerate(LRD):
            if i < j:
                continue
            if l2 == l1:
                candl.append((r2, d2))
            if r2 == r2:
                candr.append((l2, d2))
        for tl in candl:
            for tr in candr:
                if tl[0] == tr[0] and tl[1] + tr[1] != d1:
                    return False
    return True

if consistent(LRD):
    print('Yes')
else:
    print('No')