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>
const int N = 100054;
struct DC {
  int F[N];
  std::pair<int, int> D[N];
  int Discretize(int n) {
    int i, cnt = 0;
    std::sort(D, D + n);
    for (i = 0; i < n; ++i)
      F[D[i].second] =
          (i && D[i].first == D[i - 1].first ? cnt - 1
                                             : (D[cnt] = D[i], cnt++));
    return cnt;
  }
} X, Y;
int n, q, cX, cY;
int x[N], y[N], cx[N], cy[N], lx[N], ly[N];
inline void down(int &x, const int y) { x > y ? x = y : 0; }
namespace F {
const int N = 200054, M = 2003731;
struct edge {
  int u, v, f;
  edge(int u0 = 0, int v0 = 0, int f0 = 0) : u(u0), v(v0), f(f0) {}
} e[M];
int V = 2, E = 0, si = 1, ti = 2, flow;
int first[N], next[M], deg[N];
int dep[N], cur[N], que[N];
inline void addedge(int u, int v, int f) {
  e[++E] = edge(u, v, f);
  next[E] = first[u];
  first[u] = E;
  e[++E] = edge(v, u);
  next[E] = first[v];
  first[v] = E;
}
bool bfs() {
  int h, t = 1, i, x, y;
  memset(dep, -1, sizeof dep);
  que[0] = si;
  dep[si] = 0;
  for (h = 0; h < t; h++) {
    if ((x = que[h]) == ti) return true;
    for (i = first[x]; i; i = next[i])
      if (dep[y = e[i].v] == -1 && e[i].f) {
        que[t++] = y;
        dep[y] = dep[x] + 1;
      }
  }
  return false;
}
int dfs(int x, int lim) {
  int a, c, f = 0;
  if (x == ti || !lim) return lim;
  for (int &i = cur[x]; i; i = next[i])
    if (dep[e[i].v] == dep[x] + 1 && e[i].f) {
      a = std::min(lim - f, e[i].f);
      c = dfs(e[i].v, a);
      e[i].f -= c;
      e[((i - 1 ^ 1) + 1)].f += c;
      if ((f += c) == lim) return f;
    }
  return f;
}
int Dinic() {
  for (flow = 0; bfs(); flow += dfs(si, INT_MAX))
    memcpy(cur, first, sizeof cur);
  return flow;
}
inline void link(int u, int v, int l, int r) {
  addedge(u + 2, v + 2, r - l), deg[u] -= l, deg[v] += l;
}
inline void reduce(int x) {
  for (int &i = first[x]; i && e[i].v <= 2; i = next[i])
    ;
}
int main() {
  int i;
  for (i = 1; i <= V; ++i)
    if (deg[i] > 0)
      addedge(1, i + 2, deg[i]);
    else if (deg[i] < 0)
      addedge(i + 2, 2, -deg[i]);
  addedge(4, 3, INT_MAX), Dinic();
  for (i = first[1]; i; i = next[i])
    if (~dep[e[i].v]) return -1;
  first[1] = first[2] = 0;
  for (i = 1; i <= V; ++i) reduce(i + 2);
  return si = 3, ti = 4, Dinic();
}
}  // namespace F
int main() {
  int i, op, r, v, x0, y0;
  bool flip;
  long long A, B;
  scanf("%d%d%lld%lld", &n, &q, &A, &B);
  if (flip = A > B) std::swap(A, B);
  A -= B, B *= n;
  for (i = 0; i < n; ++i)
    scanf("%d%d", &x0, &y0), X.D[i] = std::pair<int, int>(x0, i),
                             Y.D[i] = std::pair<int, int>(y0, i);
  cX = X.Discretize(n), cY = Y.Discretize(n);
  for (i = 0; i < n; ++i)
    ++cx[x[i] = X.F[i]], ++cy[y[i] = Y.F[i]],
        F::link(x[i] + 3, y[i] + 3 + cX, 0, 1);
  memcpy(lx, cx, cX << 2), memcpy(ly, cy, cY << 2);
  for (; q; --q)
    if (scanf("%d%d%d", &op, &r, &v), op == 1) {
      x0 = std::lower_bound(X.D, X.D + cX, std::pair<int, int>(r, 0)) - X.D;
      if (X.D[x0].first == r) down(lx[x0], (cx[x0] + v) / 2);
    } else {
      y0 = std::lower_bound(Y.D, Y.D + cY, std::pair<int, int>(r, 0)) - Y.D;
      if (Y.D[y0].first == r) down(ly[y0], (cy[y0] + v) / 2);
    }
  for (i = 0; i < cX; ++i) {
    if (lx[i] * 2 < cx[i]) return puts("-1"), 0;
    F::link(1, i + 3, cx[i] - lx[i], lx[i]);
  }
  for (i = 0; i < cY; ++i) {
    if (ly[i] * 2 < cy[i]) return puts("-1"), 0;
    F::link(i + 3 + cX, 2, cy[i] - ly[i], ly[i]);
  }
  F::V = cX + cY + 2;
  if (!~(r = F::main())) return puts("-1"), 0;
  printf("%lld\n", A * r + B);
  flip ? (x0 = 114, y0 = 98) : (x0 = 98, y0 = 114);
  for (i = 0; i < n; ++i) putchar(F::e[i * 2 + 1].f ? x0 : y0);
  putchar(10);
  return 0;
}