#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using db = double;   using pii = pair<int, int>;   using vi = vector<int>;   mt19937 mrand(time(0));   ll get(ll r) { return ((ll)mrand() * mrand() % r + r) % r; }   ll get(ll l, ll r) { return get(r - l + 1) + l; }   int t, T, n, m, L, R = 1e9, c[100100];   pii seg[100100];   vi G[100100];   bool in(pii seg, int x) { return seg.first <= x && x <= seg.second; }   bool dfs(int x) {     for (int y : G[x])       if (!c[y]) {         c[y] = 3 - c[x];         if (!dfs(y)) return false;       } else if (c[y] == c[x])         return false;     return true;   }   signed main() {     scanf( %d %d %d %d , &t, &T, &n, &m);     for (int i = 1; i <= n; i++)       scanf( %d %d , &seg[i].first, &seg[i].second), L = max(L, seg[i].first),                                                      R = min(R, seg[i].second);     if (L + R > T) R = T - L;     if (L + R <= t) L = t - R;     if (L < 0 || R < 0) return puts( IMPOSSIBLE ), 0;     for (int i = 1; i <= n; i++) {       int l_ = in(seg[i], L), r_ = in(seg[i], R);       if (!l_ && !r_) return puts( IMPOSSIBLE ), 0;       if (l_ && !r_) c[i] = 1;       if (!l_ && r_) c[i] = 2;     }     for (int i = 1, x, y; i <= m; i++)       scanf( %d %d , &x, &y), G[x].push_back(y), G[y].push_back(x);     for (int i = 1; i <= n; i++)       if (c[i] && !dfs(i)) return puts( IMPOSSIBLE ), 0;     for (int i = 1; i <= n; i++)       if (!c[i] && (c[i] = 1) && !dfs(i)) return puts( IMPOSSIBLE ), 0;     string ans;     for (int i = 1; i <= n; i++) ans += c[i] +  0 ;     puts( POSSIBLE ), printf( %d %d n , L, R), cout << ans <<   n ;     fprintf(stderr,  time=%.4f n , (db)clock() / CLOCKS_PER_SEC);     return 0;   }   