#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int rd() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
int to[N << 1], nt[N << 1], hd[N], tot = 1;
void adde(int x, int y) {
  ++tot, to[tot] = y, nt[tot] = hd[x], hd[x] = tot;
  ++tot, to[tot] = x, nt[tot] = hd[y], hd[y] = tot;
}
int sl, sr, n, m, ra[N][2], a[N][2], tt = 1, ff[N], co[N], sq[N], tp, cn[N];
bool an[N];
queue<int> q;
bool cmp(int aa, int bb) { return a[aa][0] < a[bb][0]; }
multiset<int> sb;
int main() {
  sl = rd(), sr = rd(), n = rd(), m = rd();
  for (int i = 1; i <= n; ++i) ra[i][0] = rd(), ra[i][1] = rd();
  a[0][0] = -1, a[0][1] = 2e9;
  for (int i = 1; i <= m; ++i) adde(rd(), rd());
  for (int i = 1; i <= n; ++i)
    if (!ff[i]) {
      ++tt, a[tt][0] = a[0][0], a[tt][1] = a[0][1];
      ++tt, a[tt][0] = a[0][0], a[tt][1] = a[0][1];
      ff[i] = tt - 1, q.push(i);
      while (!q.empty()) {
        int x = q.front();
        q.pop();
        int xt = tt ^ 1 ^ co[x];
        a[xt][0] = max(a[xt][0], ra[x][0]), a[xt][1] = min(a[xt][1], ra[x][1]);
        for (int j = hd[x]; j; j = nt[j]) {
          int y = to[j];
          if (ff[y]) {
            if (co[x] == co[y]) {
              puts("IMPOSSIBLE");
              return 0;
            }
          } else
            ff[y] = ff[x] ^ 1, co[y] = co[x] ^ 1, q.push(y);
        }
      }
      if (a[tt - 1][0] > a[tt - 1][1] || a[tt][0] > a[tt][1]) {
        puts("IMPOSSIBLE");
        return 0;
      }
    }
  int m1 = 0, m2 = 0;
  for (int i = 2; i <= tt; ++i) {
    if (a[i][0] > a[m1][0]) m1 = i;
    if (a[i][1] < a[m2][1]) m2 = i;
  }
  if (a[m1][0] <= a[m2][1]) {
    int z1 = a[m1][0], z2 = a[m2][1],
        pl = max(max(a[m1 ^ 1][0], a[m2 ^ 1][0]), 0),
        pr = min(a[m1 ^ 1][1], a[m2 ^ 1][1]),
        rs = (tt >> 1) - 2 + ((m1 >> 1) == (m2 >> 1));
    an[m1 >> 1] = m1 & 1, an[m2 >> 1] = m2 & 1;
    for (int i = 2; i <= tt; ++i)
      if ((i >> 1) != (m1 >> 1) && (i >> 1) != (m2 >> 1)) sq[++tp] = i;
    sort(sq + 1, sq + tp + 1, cmp);
    sb.insert(pr);
    for (int i = 0; i <= tp; ++i) {
      int x = sq[i];
      if (x) {
        if (a[x][0] > pr) break;
        ++cn[x >> 1];
        if (cn[x >> 1] == 1)
          --rs, sb.insert(a[x][1]), an[x >> 1] = (x & 1) ^ 1;
        else {
          int y = x ^ 1;
          if (a[x][1] > a[y][1])
            sb.erase(sb.find(a[y][1])), sb.insert(a[x][1]), an[x >> 1] ^= 1;
        }
      }
      int nl = max(pl, a[x][0]), nr = (*sb.begin());
      if (rs <= 0 && nl <= nr && max(nl + z1, sl) <= min(nr + z2, sr)) {
        puts("POSSIBLE");
        int mm = sl - (z1 + nl);
        if (mm > 0) {
          if (z1 + mm <= z2)
            z1 += mm;
          else
            nl += mm - (z2 - z1), z1 = z2;
        }
        printf("%d %d\n", z1, nl);
        for (int i = 1; i <= n; ++i)
          printf("%d", 1 + ((an[ff[i] >> 1] ^ ff[i]) & 1));
        return 0;
      }
    }
  }
  tp = 0;
  sb.clear();
  memset(cn, 0, sizeof(cn));
  if (m1 != m2) {
    int z1 = a[m1][0], z2 = a[m2][1], pl = max(max(a[m1 ^ 1][0], a[m2][0]), 0),
        pr = min(a[m1][1], a[m2 ^ 1][1]),
        rs = (tt >> 1) - 2 + ((m1 >> 1) == (m2 >> 1));
    an[m1 >> 1] = m1 & 1, an[m2 >> 1] = (m2 & 1) ^ 1;
    for (int i = 2; i <= tt; ++i)
      if ((i >> 1) != (m1 >> 1) && (i >> 1) != (m2 >> 1)) sq[++tp] = i;
    sort(sq + 1, sq + tp + 1, cmp);
    sb.insert(pr);
    for (int i = 0; i <= tp; ++i) {
      int x = sq[i];
      if (x) {
        if (a[x][0] > z2) break;
        ++cn[x >> 1];
        if (cn[x >> 1] == 1)
          --rs, sb.insert(a[x ^ 1][1]), an[x >> 1] = (x & 1) ^ 1;
        else {
          int y = x ^ 1;
          if (a[y][1] > a[x][1])
            sb.erase(sb.find(a[x][1])), sb.insert(a[y][1]), an[x >> 1] ^= 1;
        }
      }
      int nl = max(pl, a[x][0]), nr = (*sb.begin());
      if (rs <= 0 && z1 <= nr && nl <= z2 &&
          max(nl + z1, sl) <= min(nr + z2, sr)) {
        puts("POSSIBLE");
        int mm = sl - (z1 + nl);
        if (mm > 0) {
          if (z1 + mm <= nr)
            z1 += mm;
          else
            nl += mm - (nr - z1), z1 = nr;
        }
        printf("%d %d\n", z1, nl);
        for (int i = 1; i <= n; ++i)
          printf("%d", 1 + ((an[ff[i] >> 1] ^ ff[i]) & 1));
        return 0;
      }
    }
  }
  puts("IMPOSSIBLE");
  return 0;
}
