Problem: Steve Rogers is fascinated with new vibranium shields S.H.I.E.L.D gave him. They're all uncolored. There are n shields in total, the i-th shield is located at point (xi, yi) of the coordinate plane. It's possible that two or more shields share the same location.

Steve wants to paint all these shields. He paints each shield in either red or blue. Painting a shield in red costs r dollars while painting it in blue costs b dollars.

Additionally, there are m constraints Steve wants to be satisfied. The i-th constraint is provided by three integers ti, li and di:

  * If ti = 1, then the absolute difference between the number of red and blue shields on line x = li should not exceed di. 
  * If ti = 2, then the absolute difference between the number of red and blue shields on line y = li should not exceed di. 



Steve gave you the task of finding the painting that satisfies all the condition and the total cost is minimum.

Input

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 100 000) — the number of shields and the number of constraints respectively.

The second line contains two integers r and b (1 ≤ r, b ≤ 109).

The next n lines contain the shields coordinates. The i-th of these lines contains two integers xi and yi (1 ≤ xi, yi ≤ 109).

The next m lines contain the constrains. The j-th of these lines contains three integers tj, lj and dj (1 ≤ tj ≤ 2, 1 ≤ lj ≤ 109, 0 ≤ dj ≤ n).

Output

If satisfying all the constraints is impossible print -1 in first and only line of the output.

Otherwise, print the minimum total cost in the first line of output. In the second line print a string of length n consisting of letters 'r' and 'b' only. The i-th character should be 'r' if the i-th shield should be painted red in the optimal answer and 'b' if it should be painted blue. The cost of painting shields in these colors should be equal the minimum cost you printed on the first line.

If there exist more than one optimal solution, print any of them.

Examples

Input

5 6
8 3
2 10
1 5
9 10
9 10
2 8
1 9 1
1 2 1
2 10 3
2 10 2
1 1 1
2 5 2


Output

25
rbrbb


Input

4 4
7 3
10 3
9 8
10 3
2 8
2 8 0
2 8 0
1 2 0
1 9 0


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
inline int read() {
  char c;
  int x;
  for (c = getchar(); !isdigit(c); c = getchar())
    ;
  for (x = 0; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  return x;
}
const int inf = 1e9;
const int N = 1e5 + 5, V = N * 2, E = 4e6 + 5;
int n1, n2, m, q, k1, k2, a1[N], a2[N], tb1[N], tb2[N], cnt1[N], cnt2[N],
    lim1[N], lim2[N];
int s, t, ss, tt, ans, dis[V], cur[V], deg[V];
bool flag, vis[V];
struct List {
  int tot, fst[V], nxt[E], to[E], val[E], flw[E];
  List() { memset(fst, -1, sizeof(fst)); }
  inline void insert(int u, int v, int w) {
    nxt[tot] = fst[u];
    to[tot] = v;
    val[tot] = w;
    fst[u] = tot++;
  }
  inline void link(int u, int v, int w) {
    insert(u, v, w);
    insert(v, u, 0);
  }
} e;
bool bfs() {
  memset(dis, 60, sizeof(dis));
  memcpy(cur, e.fst, sizeof(cur));
  dis[s] = 0;
  std::queue<int> que;
  for (que.push(s); !que.empty(); que.pop()) {
    int u = que.front();
    for (int i = e.fst[u]; ~i; i = e.nxt[i]) {
      int v = e.to[i], w = e.val[i], f = e.flw[i];
      if (dis[v] > dis[u] + 1 && w > f) {
        dis[v] = dis[u] + 1;
        if (v == t) {
          return true;
        }
        que.push(v);
      }
    }
  }
  return false;
}
int dinic(int u, int _f) {
  if (u == t) {
    return _f;
  }
  int lef = _f;
  vis[u] = true;
  for (int &i = cur[u]; ~i; i = e.nxt[i]) {
    int v = e.to[i], w = e.val[i], f = e.flw[i];
    if (dis[v] == dis[u] + 1 && w > f && !vis[v]) {
      int def = dinic(v, std::min(lef, w - f));
      if (def == 0) {
        dis[v] = -1;
        continue;
      }
      lef -= def;
      e.flw[i] += def;
      e.flw[i ^ 1] -= def;
      if (lef == 0) {
        break;
      }
    }
  }
  vis[u] = false;
  return _f - lef;
}
int main() {
  m = read();
  q = read();
  k1 = read();
  k2 = read();
  if (k1 > k2) {
    std::swap(k1, k2);
    flag = true;
  }
  for (int i = 0; i < m; i++) {
    a1[i] = read();
    tb1[n1++] = a1[i];
    a2[i] = read();
    tb2[n2++] = a2[i];
  }
  std::sort(tb1, tb1 + n1);
  n1 = std::unique(tb1, tb1 + n1) - tb1;
  std::sort(tb2, tb2 + n2);
  n2 = std::unique(tb2, tb2 + n2) - tb2;
  s = 0;
  t = n1 + n2 + 3;
  ss = n1 + n2 + 1;
  tt = n1 + n2 + 2;
  for (int i = 0; i < m; i++) {
    a1[i] = std::lower_bound(tb1, tb1 + n1, a1[i]) - tb1;
    a2[i] = std::lower_bound(tb2, tb2 + n2, a2[i]) - tb2;
    cnt1[a1[i]]++;
    cnt2[a2[i]]++;
    int u = a1[i] + 1, v = n1 + a2[i] + 1;
    e.link(u, v, 1);
  }
  memset(lim1, 60, n1 * 4);
  memset(lim2, 60, n2 * 4);
  for (int i = 0; i < q; i++) {
    int opt = read(), x = read(), y = read(), u;
    if (opt == 1) {
      u = std::lower_bound(tb1, tb1 + n1, x) - tb1;
      if (tb1[u] == x) {
        lim1[u] = std::min(lim1[u], y);
      }
    } else {
      u = std::lower_bound(tb2, tb2 + n2, x) - tb2;
      if (tb2[u] == x) {
        lim2[u] = std::min(lim2[u], y);
      }
    }
  }
  for (int i = 0; i < n1; i++) {
    int u = i + 1;
    int l = std::max(0, (cnt1[i] - lim1[i] + 1) / 2);
    int r = (cnt1[i] + lim1[i]) / 2;
    if (l > r) {
      printf("-1\n");
      return 0;
    }
    e.link(ss, u, r - l);
    deg[ss] -= l;
    deg[u] += l;
  }
  for (int i = 0; i < n2; i++) {
    int u = n1 + i + 1;
    int l = std::max(0, (cnt2[i] - lim2[i] + 1) / 2);
    int r = (cnt2[i] + lim2[i]) / 2;
    if (l > r) {
      printf("-1\n");
      return 0;
    }
    e.link(u, tt, r - l);
    deg[u] -= l;
    deg[tt] += l;
  }
  for (int u = 1; u <= tt; u++) {
    if (deg[u] > 0) {
      e.link(s, u, deg[u]);
    }
    if (deg[u] < 0) {
      e.link(u, t, -deg[u]);
    }
  }
  e.link(tt, ss, inf);
  while (bfs()) {
    dinic(s, inf);
  }
  s = ss;
  t = tt;
  ans = e.flw[e.tot - 2];
  e.val[e.tot - 1] = e.flw[e.tot - 1] = 0;
  e.val[e.tot - 2] = e.flw[e.tot - 2] = 0;
  while (bfs()) {
    ans += dinic(s, inf);
  }
  printf("%lld\n", 1ll * k1 * ans + 1ll * k2 * (m - ans));
  for (int i = 0; i < m; i++) {
    putchar(e.flw[i * 2] != flag ? 'r' : 'b');
  }
  return 0;
}