MAX = 10**9

def main():
    n, m = map(int, input().split())
    info = []
    for _ in range(m):
        l, r, d = map(int, input().split())
        info.append([l-1, r-1, d])
    info.sort()
    min_x = None
    max_x = None
    x = {}
    while info:
        for l, r, _ in info:
            if l in x:
                p = l
                break
            elif r in x:
                p = r
                break
        else:
            if min_x is not None:
                if max_x - min_x > MAX:
                    print('No')
                    return
            p = info[0][0]
            x = {p: 0}
            max_x = min_x = 0
        rest = []
        for l, r, d in info:
            if l in x:
                pr = x[l] + d
                if r not in x:
                    x[r] = pr
                    max_x = max(max_x, pr)
                    min_x = min(min_x, pr)
                elif x[r] != pr:
                    print('No')
                    return
            elif r in x:
                pl = x[r] - d
                if l not in x:
                    x[l] = pl
                    max_x = max(max_x, pl)
                    min_x = min(min_x, pl)
                elif x[l] != pl:
                    print('No')
                    return
            else:
                rest.append([l, r, d])
        info = rest
    print('Yes')


if __name__ == '__main__':
    main()
