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;
const int MAXN = (int)1e5 + 10;
int n, m, f[MAXN], l[MAXN], r[MAXN], opp[MAXN], t, T, N, bel[MAXN], vis[MAXN];
vector<pair<int, pair<int, int> > > L;
int getf(int first) {
  if (f[first] == first) return first;
  f[first] = getf(f[first]);
  return f[first];
}
void fail() { puts("IMPOSSIBLE"), exit(0); }
void check(int first, int second) {
  if (!(first + second >= t && first + second <= T)) return;
  ++first, ++second;
  memset(bel, 0, sizeof(bel));
  for (int i = 1; i <= n; ++i)
    if (getf(i) == i && !bel[opp[i]]) {
      if (!opp[i]) {
        if (l[i] <= first && first <= r[i]) bel[i] = 1;
        if (l[i] <= second && second <= r[i]) bel[i] = 2;
      } else {
        if (l[i] <= first && first <= r[i] && l[opp[i]] <= second &&
            second <= r[opp[i]])
          bel[i] = 1, bel[opp[i]] = 2;
        if (l[i] <= second && second <= r[i] && l[opp[i]] <= first &&
            first <= r[opp[i]])
          bel[i] = 2, bel[opp[i]] = 1;
      }
      if (!bel[i]) return;
    }
  puts("POSSIBLE");
  printf("%d %d\n", first - 1, second - 1);
  for (int i = 1; i <= n; ++i) printf("%d", bel[getf(i)]);
  puts(""), exit(0);
}
void check(int p, int l, int r) {
  if (l <= t - p && t - p <= r) check(p, t - p);
  if (l <= T - p && T - p <= r) check(p, T - p);
  check(p, l), check(p, r);
}
void check(int al, int ar, int bl, int br) {
  --al, --ar, --bl, --br;
  check(al, bl, br), check(ar, bl, br), check(bl, al, ar), check(br, al, ar);
}
int main() {
  scanf("%d%d%d%d", &t, &T, &n, &m);
  for (int i = 1; i <= n; ++i)
    scanf("%d%d", &l[i], &r[i]), f[i] = i, ++l[i], ++r[i];
  for (int i = 1; i <= m; ++i) {
    int first, second;
    scanf("%d%d", &first, &second);
    first = getf(first), second = getf(second);
    if (first == second) fail();
    if (!opp[first] && !opp[second])
      opp[first] = second, opp[second] = first;
    else if (!opp[first] || !opp[second]) {
      if (!opp[first]) swap(first, second);
      f[second] = opp[first];
    } else {
      f[opp[first]] = second, f[opp[second]] = first;
      opp[first] = second, opp[second] = first;
    }
  }
  for (int i = 1; i <= n; ++i) {
    int first = getf(i);
    l[first] = max(l[first], l[i]);
    r[first] = min(r[first], r[i]);
    if (l[first] > r[first]) fail();
    if (i == first) N += 1 + !opp[i];
  }
  for (int i = 1; i <= n; ++i)
    if (getf(i) == i && !vis[i]) {
      if (!opp[i]) {
        L.push_back(make_pair(1, make_pair(l[i], 0)));
        L.push_back(make_pair(1, make_pair(r[i], 1)));
        L.push_back(make_pair(l[i], make_pair(-l[i], 0)));
        L.push_back(make_pair(l[i], make_pair(-r[i], 1)));
        L.push_back(make_pair(l[i], make_pair(1, 0)));
        L.push_back(make_pair(l[i], make_pair((int)1e9 + 1, 1)));
        L.push_back(make_pair(r[i] + 1, make_pair(-1, 0)));
        L.push_back(make_pair(r[i] + 1, make_pair(-((int)1e9 + 1), 1)));
        L.push_back(make_pair(r[i] + 1, make_pair(l[i], 0)));
        L.push_back(make_pair(r[i] + 1, make_pair(r[i], 1)));
        L.push_back(make_pair((int)1e9 + 1, make_pair(-l[i], 0)));
        L.push_back(make_pair((int)1e9 + 1, make_pair(-r[i], 1)));
      } else {
        int j = opp[i];
        if (r[i] < l[j] || r[j] < l[i])
          L.push_back(make_pair(l[i], make_pair(l[j], 0))),
              L.push_back(make_pair(l[i], make_pair(r[j], 1))),
              L.push_back(make_pair(r[i] + 1, make_pair(-l[j], 0))),
              L.push_back(make_pair(r[i] + 1, make_pair(-r[j], 1)));
        else if (l[i] <= l[j] && r[j] <= r[i]) {
          vis[i] = vis[j] = 1;
          L.push_back(make_pair(l[i], make_pair(l[j], 0))),
              L.push_back(make_pair(l[i], make_pair(r[j], 1))),
              L.push_back(make_pair(l[j], make_pair(-l[j], 0))),
              L.push_back(make_pair(l[j], make_pair(-r[j], 1))),
              L.push_back(make_pair(l[j], make_pair(l[i], 0))),
              L.push_back(make_pair(l[j], make_pair(r[i], 1))),
              L.push_back(make_pair(r[j] + 1, make_pair(-l[i], 0))),
              L.push_back(make_pair(r[j] + 1, make_pair(-r[i], 1))),
              L.push_back(make_pair(r[j] + 1, make_pair(l[j], 0))),
              L.push_back(make_pair(r[j] + 1, make_pair(r[j], 1))),
              L.push_back(make_pair(r[i] + 1, make_pair(-l[j], 0))),
              L.push_back(make_pair(r[i] + 1, make_pair(-r[j], 1)));
        } else if (l[i] <= l[j] && l[j] <= r[i] && r[i] <= r[j]) {
          vis[i] = vis[j] = 1;
          L.push_back(make_pair(l[i], make_pair(l[j], 0))),
              L.push_back(make_pair(l[i], make_pair(r[j], 1))),
              L.push_back(make_pair(l[j], make_pair(-l[j], 0))),
              L.push_back(make_pair(l[j], make_pair(l[i], 0))),
              L.push_back(make_pair(r[i] + 1, make_pair(-r[j], 1)));
          L.push_back(make_pair(r[i] + 1, make_pair(r[i], 1)));
          L.push_back(make_pair(r[j] + 1, make_pair(-l[i], 0)));
          L.push_back(make_pair(r[j] + 1, make_pair(-r[i], 1)));
        }
      }
    }
  for (int i = 0; i < ((int)(L).size()); ++i)
    L[i].second.first = -L[i].second.first;
  sort((L).begin(), (L).end());
  multiset<int> s[2];
  N /= 2;
  for (int i = 0; i < ((int)(L).size()); ++i) {
    if (L[i].second.first < 0)
      s[L[i].second.second].insert(-L[i].second.first);
    else
      s[L[i].second.second].erase(
          s[L[i].second.second].lower_bound(L[i].second.first));
    if (((int)(s[0]).size()) == N && ((int)(s[1]).size()) == N &&
        *s[0].rbegin() <= *s[1].begin())
      if (i < ((int)(L).size()) - 1 && L[i].first < L[i + 1].first)
        check(L[i].first, L[i + 1].first - 1, *s[0].rbegin(), *s[1].begin());
  }
  fail();
  fclose(stdin);
  fclose(stdout);
  return 0;
}
