T students applied into the ZPP class of Summer Irrelevant School. The organizing committee of the school may enroll any number of them, but at least t students must be enrolled. The enrolled students should be divided into two groups in any manner (it is possible that one of the groups will be empty!)

During a shift the students from the ZPP grade are tutored by n teachers. Due to the nature of the educational process, each of the teachers should be assigned to exactly one of two groups (it is possible that no teacher will be assigned to some of the groups!). The i-th teacher is willing to work in a group as long as the group will have at least li and at most ri students (otherwise it would be either too boring or too hard). Besides, some pairs of the teachers don't like each other other and therefore can not work in the same group; in total there are m pairs of conflicting teachers.

You, as the head teacher of Summer Irrelevant School, have got a difficult task: to determine how many students to enroll in each of the groups and in which group each teacher will teach.

Input

The first line contains two space-separated integers, t and T (1 ≤ t ≤ T ≤ 109).

The second line contains two space-separated integers n and m (1 ≤ n ≤ 105, 0 ≤ m ≤ 105).

The i-th of the next n lines contain integers li and ri (0 ≤ li ≤ ri ≤ 109).

The next m lines describe the pairs of conflicting teachers. Each of these lines contain two space-separated integers — the indices of teachers in the pair. The teachers are indexed starting from one. It is guaranteed that no teacher has a conflict with himself and no pair of conflicting teachers occurs in the list more than once.

Output

If the distribution is possible, print in the first line a single word 'POSSIBLE' (without the quotes). In the second line print two space-separated integers n1 and n2 — the number of students in the first and second group, correspondingly, the contstraint t ≤ n1 + n2 ≤ T should be met. In the third line print n characters, the i-th of which should be 1 or 2, if the i-th teacher should be assigned to the first or second group, correspondingly. If there are multiple possible distributions of students and teachers in groups, you can print any of them.

If the sought distribution doesn't exist, print a single word 'IMPOSSIBLE' (without the quotes).

Examples

Input

10 20
3 0
3 6
4 9
16 25


Output

POSSIBLE
4 16
112


Input

1 10
3 3
0 10
0 10
0 10
1 2
1 3
2 3


Output

IMPOSSIBLE
#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chkmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
int readint() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int lt, rt, n, m, cnt, tot, l0, r0, l1, r1;
int l[100005], r[100005], v[200005], nxt[200005], h[100005], col[100005],
    ans[100005], bl[100005];
pair<pair<int, int>, pair<int, int> > a[200005];
void addedge(int x, int y) {
  v[++tot] = y;
  nxt[tot] = h[x];
  h[x] = tot;
  v[++tot] = x;
  nxt[tot] = h[y];
  h[y] = tot;
}
bool dfs(int u, int c) {
  col[u] = c;
  if (!c)
    chkmax(l0, l[u]), chkmin(r0, r[u]);
  else
    chkmax(l1, l[u]), chkmin(r1, r[u]);
  for (int p = h[u]; p; p = nxt[p]) {
    if (col[v[p]] < 0 && !dfs(v[p], c ^ 1))
      return false;
    else if (col[v[p]] >= 0 && col[v[p]] != (c ^ 1))
      return false;
  }
  return true;
}
void getans(int u, int c) {
  ans[u] = c;
  for (int p = h[u]; p; p = nxt[p])
    if (ans[v[p]] < 0) getans(v[p], c ^ 1);
}
int main() {
  lt = readint();
  rt = readint();
  n = readint();
  m = readint();
  for (int i = 1; i <= n; i++) l[i] = readint(), r[i] = readint();
  int x, y;
  for (int i = 1; i <= m; i++) {
    x = readint();
    y = readint();
    addedge(x, y);
  }
  memset(col, -1, sizeof(col));
  for (int i = 1; i <= n; i++) {
    if (col[i] < 0) {
      l0 = 0, r0 = 1e9, l1 = 0, r1 = 1e9;
      if (!dfs(i, 0)) return printf("IMPOSSIBLE\n"), 0;
      if (l0 > 0 || r0 < 1e9)
        a[++cnt] = make_pair(make_pair(l0, r0), make_pair(i, 0));
      if (l1 > 0 || r1 < 1e9)
        a[++cnt] = make_pair(make_pair(l1, r1), make_pair(i, 1));
    }
  }
  int lf = 1e9, rg = 0;
  for (int i = 1; i <= cnt; i++)
    chkmin(lf, a[i].first.second), chkmax(rg, a[i].first.first);
  if (lf + rg < lt)
    rg = lt - lf;
  else if (lf + rg > rt)
    lf = rt - rg;
  if (lf < 0 || rg < 0) return printf("IMPOSSIBLE\n"), 0;
  for (int i = 1; i <= cnt; i++)
    if (a[i].first.first > lf && a[i].first.second < rg)
      return printf("IMPOSSIBLE\n"), 0;
  memset(bl, -1, sizeof(bl));
  for (int i = 1; i <= cnt; i++) {
    if (bl[a[i].second.first] >= 0) {
      if ((bl[a[i].second.first] ^ a[i].second.second) == 1 &&
          a[i].first.second < rg)
        return printf("IMPOSSIBLE\n"), 0;
      else if ((bl[a[i].second.first] ^ a[i].second.second) == 0 &&
               a[i].first.first > lf)
        return printf("IMPOSSIBLE\n"), 0;
      continue;
    }
    if (a[i].first.second < rg) bl[a[i].second.first] = a[i].second.second;
    if (a[i].first.first > lf) bl[a[i].second.first] = a[i].second.second ^ 1;
  }
  for (int i = 1; i <= cnt; i++)
    if (bl[a[i].second.first] < 0) bl[a[i].second.first] = 0;
  memset(ans, -1, sizeof(ans));
  for (int i = 1; i <= n; i++)
    if (bl[i] >= 0) getans(i, bl[i]);
  printf("POSSIBLE\n%d %d\n", lf, rg);
  for (int i = 1; i <= n; i++) printf("%d", ans[i] + 1);
  printf("\n");
  return 0;
}
