#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; using ll=long long; typedef pair P; int main() { int n, m; cin>>n>>m; ll b[100010]; for(int i=0; i>b[i]; if(i&1) b[i]=-b[i]; } ll d[100010]; for(int i=1; i g[100010]; for(int i=0; i>l[i]>>r[i]; l[i]--; g[l[i]].push_back(r[i]); g[r[i]].push_back(l[i]); } bool used[100010]={}; auto dfs=[&](auto dfs, int x, ll &s)->void{ s+=d[x]; used[x]=1; for(auto y:g[x]){ if(!used[y]){ dfs(dfs, y, s); } } }; for(int i=0; i<=n; i++){ if(used[i]) continue; ll s=0; dfs(dfs, i, s); if(s!=0){ cout<<"NO"<