#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int stot, l3[N], r3[N], from[N], cnt, first[N], zz[N], ne[N], t1, t2, x[N],
    y[N], a[N], Flag[N], flag[N], n, m, l1[N], tot, r1[N], l2[N], r2[N];
vector<pair<int, int> > v1[N], v2[N];
struct Tree {
  int l, r, flag;
  pair<int, int> num;
} T[N * 4];
int ef(int x) {
  int l = 1, r = tot;
  while (l < r) {
    int mid = (l + r) / 2;
    if (a[mid] < x)
      l = mid + 1;
    else
      r = mid;
  }
  return l;
}
pair<int, int> hb(pair<int, int> x, pair<int, int> y) {
  if (x.first >= y.first) return x;
  return y;
}
void build(int x, int l, int r) {
  T[x].l = l;
  T[x].r = r;
  if (l == r) {
    T[x].num = make_pair(0, l);
    return;
  }
  int mid = (l + r) / 2;
  build(x * 2, l, mid);
  build(x * 2 + 1, mid + 1, r);
  T[x].num = hb(T[x * 2].num, T[x * 2 + 1].num);
}
void down(int x) {
  T[x * 2].num.first += T[x].flag;
  T[x * 2 + 1].num.first += T[x].flag;
  T[x * 2].flag += T[x].flag;
  T[x * 2 + 1].flag += T[x].flag;
  T[x].flag = 0;
}
void insert(int x, int l, int r, int z) {
  if (T[x].l > r || l > T[x].r) return;
  if (T[x].l >= l && T[x].r <= r) {
    T[x].num.first += z;
    T[x].flag += z;
    return;
  }
  down(x);
  insert(x * 2, l, r, z);
  insert(x * 2 + 1, l, r, z);
  T[x].num = hb(T[x * 2].num, T[x * 2 + 1].num);
}
pair<int, int> find(int x, int l, int r) {
  if (T[x].l > r || l > T[x].r) return make_pair(-1, 0);
  if (T[x].l >= l && T[x].r <= r) return T[x].num;
  down(x);
  return hb(find(x * 2, l, r), find(x * 2 + 1, l, r));
}
void jb(int x, int y) {
  ne[++stot] = first[x];
  first[x] = stot;
  zz[stot] = y;
}
void dfs(int now) {
  from[now] = cnt;
  if (flag[now] == 1) {
    l1[cnt] = max(l1[cnt], x[now]);
    r1[cnt] = min(r1[cnt], y[now]);
  } else {
    l2[cnt] = max(l2[cnt], x[now]);
    r2[cnt] = min(r2[cnt], y[now]);
  }
  for (int i = first[now]; i; i = ne[i])
    if (!flag[zz[i]])
      flag[zz[i]] = 3 - flag[now], dfs(zz[i]);
    else if (flag[zz[i]] + flag[now] != 3) {
      puts("IMPOSSIBLE");
      exit(0);
    }
}
int main() {
  scanf("%d%d", &t1, &t2);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &x[i], &y[i]), a[++tot] = x[i], a[++tot] = y[i] + 1;
  sort(a + 1, a + tot + 1);
  int v = 1;
  for (int i = 2; i <= tot; i++)
    if (a[v] != a[i]) a[++v] = a[i];
  tot = v;
  for (int i = 1; i <= n; i++) x[i] = ef(x[i]), y[i] = ef(y[i] + 1);
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    jb(x, y);
    jb(y, x);
  }
  for (int i = 1; i <= n; i++)
    if (!flag[i]) {
      cnt++;
      l1[cnt] = l2[cnt] = 0;
      r1[cnt] = r2[cnt] = tot + 1;
      flag[i] = 1;
      dfs(i);
      if (l1[cnt] < r1[cnt] && l2[cnt] < r2[cnt]) {
        v1[l1[cnt]].push_back(make_pair(l2[cnt], r2[cnt] - 1));
        v2[r1[cnt]].push_back(make_pair(l2[cnt], r2[cnt] - 1));
        v1[l2[cnt]].push_back(make_pair(l1[cnt], r1[cnt] - 1));
        v2[r2[cnt]].push_back(make_pair(l1[cnt], r1[cnt] - 1));
      }
      l3[cnt] = max(l1[cnt], l2[cnt]);
      r3[cnt] = min(r1[cnt], r2[cnt]);
      if (l3[cnt] < r3[cnt]) {
        v2[l3[cnt]].push_back(make_pair(l3[cnt], r3[cnt] - 1));
        v1[r3[cnt]].push_back(make_pair(l3[cnt], r3[cnt] - 1));
      }
    }
  build(1, 0, tot + 1);
  int X = -1, Y = -1;
  a[0] = 0;
  a[tot + 1] = a[tot + 2] = 1e9;
  for (int i = 0; i <= tot; i++)
    if (a[i] <= t2) {
      for (int j = 0; j < (int)v1[i].size(); j++)
        insert(1, v1[i][j].first, v1[i][j].second, 1);
      for (int j = 0; j < (int)v2[i].size(); j++)
        insert(1, v2[i][j].first, v2[i][j].second, -1);
      int l = 0, r = tot + 1;
      while (l < r) {
        int mid = (l + r) / 2;
        if (a[mid + 1] - 1 + a[i + 1] - 1 >= t1)
          r = mid;
        else
          l = mid + 1;
      }
      int k1 = l;
      l = 0, r = tot + 1;
      while (l < r) {
        int mid = (l + r + 1) / 2;
        if (a[mid] + a[i] <= t2)
          l = mid;
        else
          r = mid - 1;
      }
      int k2 = l;
      pair<int, int> ans = find(1, k1, k2);
      if (ans.first == cnt) {
        X = a[i];
        Y = a[ans.second];
        int C = max(min(t1 - X - Y, a[ans.second + 1] - a[ans.second] - 1), 0);
        Y += C;
        C = max(min(t1 - X - Y, a[i + 1] - a[i] - 1), 0);
        X += C;
        break;
      }
    }
  if (X == -1) {
    puts("IMPOSSIBLE");
    return 0;
  }
  puts("POSSIBLE");
  for (int i = 1; i <= n; i++) l1[i] = a[l1[i]], l2[i] = a[l2[i]];
  for (int i = 1; i <= n; i++) r1[i] = a[r1[i]] - 1, r2[i] = a[r2[i]] - 1;
  printf("%d %d\n", X, Y);
  for (int i = 1; i <= cnt; i++)
    if (l1[i] <= X && r1[i] >= X && l2[i] <= Y && r2[i] >= Y)
      Flag[i] = 0;
    else
      Flag[i] = 1;
  for (int i = 1; i <= n; i++)
    if (Flag[from[i]]) {
      if (flag[i] == 1)
        flag[i] = 2;
      else
        flag[i] = 1;
    }
  for (int i = 1; i <= n; i++) printf("%d", flag[i]);
  puts("");
  return 0;
}
