using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ARC90_2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);
            int[] x = new int[N+1];
            int[] xf = new int[N + 1];
            bool F = true;
            for (int i = 0; i < N; i++)
            {
                x[i + 1] = -1;
                xf[i + 1] = 0;
            }
            for (int i = 0; i < M; i++)
            {
                string[] b = Console.ReadLine().Split();
                int L = int.Parse(b[0]);
                int R = int.Parse(b[1]);
                int D = int.Parse(b[2]);
                xf[L] = 1;
                if (xf[R] == 0 && x[R] == -1)
                {
                    x[R] = x[L] + D;
                }
                if (x[R] != -1 && x[R] != x[L] + D)
                      {
                        F = false;
                        break;
                    }
                if(xf[R] == 1 && (x[R] != x[L] + D))
                {
                    F = false;
                    break;

                }
            }
            if (F)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}
