#include using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N,M; cin>>N>>M; vector A(N); for(int i=0;i>A[i]; vector> G(N); for(int i=0;i>u>>v; u--;v--; G[u].push_back(A[v]); G[v].push_back(A[u]); } for(int i=0;i