#pragma GCC optimize("Ofast") #include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; void solve() { int n, m; cin >> n >> m; vector a(n); rep(i, 0, n) cin >> a[i]; vector cnt(n, vector(n, 0)); rep(i, 0, m) { int u, v; cin >> u >> v; u--, v--; cnt[u][v]++; cnt[v][u]++; } auto vadd = [&](vector& v, int x) { rep(i, 0, n) v[i] += cnt[x][i]; }; rep(bit, 0, 1 << n) { vector v(n, 0); rep(i, 0, n) if (bit >> i & 1) vadd(v, i); if (v == a) { cout << "Yes\n"; rep(i, 0, n) cout << (bit >> i & 1) << ' '; cout << '\n'; return; } } cout << "No\n"; } int main() { int t = 1; // cin >> t; while (t--) solve(); }