#include using namespace std; using ll = long long; #ifdef LOCAL #include #else #define debug(...) #endif int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); int N, M; cin >> N >> M; vector A(N); for (int i = 0; i < N; i++) cin >> A[i]; vector> G(N); for (int i = 0; i < M; i++) { int U, V; cin >> U >> V, U--, V--; G[U].emplace_back(V); G[V].emplace_back(U); } for (int bit = 0; bit < (1 << N); bit++) { vector bomb(N); for (int i = 0; i < N; i++) { if (bit & (1 << i)) bomb[i] = true; } vector adj(N); for (int i = 0; i < N; i++) { for (int j : G[i]) { if (bomb[j]) adj[i]++; } } if (adj == A) { cout << "Yes" << "\n"; for (int i = 0; i < N; i++) { cout << bomb[i] << " \n"[i + 1 == N]; } return 0; } } cout << "No" << "\n"; }