#include #include #include using namespace std; int main(){ int n,m; cin>>n>>m; vectora(n+1); for(int i=1;i<=n;i++){ cin>>a[i]; } vector>edges(n+1); vectordeg(n+1,0); map ,bool>mp; for(int i=1;i<=m;i++){ int x,y; cin>>x>>y; if(x>y) swap(x,y); if(mp[{x,y}]) continue; edges.push_back({x,y}); deg[x]++; deg[y]++; mp[{x,y}] = true; } vector>g(n+1); auto smaller=[&](int x,int y){ if(deg[x]!=deg[y]) return deg[x]