#!/usr/bin/env python
import sys
sys.setrecursionlimit(300000)


def dfs(x, ls, rs, pos):
    xpos = 0 if pos[x] is None else pos[x]
    pos[x] = 0
    for r, d in ls.get(x, []):
        if pos[r] is not None:
            if pos[r] - xpos != d:
                return False
        else:
            pos[r] = xpos + d
            if not dfs(r, ls, rs, pos):
                return False
    for l, d in rs.get(x, []):
        if pos[l] is not None:
            if xpos - pos[l] != d:
                return False
        else:
            pos[l] = xpos - d
            if not dfs(l, ls, rs, pos):
                return False
    return True


def main():
    n, m = list(map(int, input().split()))
    pos = [None for _ in range(n + 1)]

    ls = {}
    rs = {}
    for _ in range(m):
        l, r, d = list(map(int, input().split()))
        lsl = ls.get(l, [])
        lsl.append((r, d))
        ls[l] = lsl
        rsr = rs.get(r, [])
        rsr.append((l, d))
        rs[r] = rsr

    for i in range(n):
        if not dfs(i+1, ls, rs, pos):
            print('No')
            return

    pos = list(filter(lambda x: x is not None, pos))
    if len(pos) > 0:
        L, R = min(pos), max(pos)
        if R - L > 1e9:
            print('No')
            return

    print('Yes')


if __name__ == '__main__':
    main()
