#Lutece2714. 开会了

开会了

Migrated from Lutece 2714 开会了

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

今天 div2 开会,但 F_know 又睡过头了,于是问 stc 会上讲了啥。

stc 说今天总共讲了 nn 件事,每件事都有一个重要度,第 ii 件事的重要度为一个整数 aia_i。但 stc 记不清 aia_i 具体为多少了,他只记得 mm 个约束条件,第 jj 个约束条件有三个整数 u,v,wu,v,w,表示 auavwa_u-a_v\le w

请判断是否至少存在一组 aa 的值满足上述条件。

Input

第一行有两个整数 n,mn,m1n,m5×1031\le n,m \le 5\times 10^3) 接下来 mm 行每行三个整数 u,v,wu,v,w1u,vn1\le u,v\le n104w104-10^4\le w\le 10^4

Output

如果 aa 有解,输出 YES,否则输出 NO。

Samples

3 3
1 2 3
2 3 -2
1 3 1
YES

Resources

2022 UESTC ICPC Training for Graph