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>
using namespace std;
inline void read(int &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 233333, M = N * 8, inf = 0x3f3f3f3f;
int n, m, S, T, head[N], cur[N], nxt[M], cap[M], to[M], edgenum = 1;
void addedge(int u, int v, int c) {
  to[++edgenum] = v;
  cap[edgenum] = c;
  nxt[edgenum] = head[u];
  head[u] = edgenum;
}
void add(int u, int v, int c) {
  if (c) {
    addedge(u, v, c);
    addedge(v, u, 0);
  }
}
void addedge(int u, int v, int l, int r) {
  if (l > r) {
    puts("-1");
    exit(0);
  }
  add(u, v, r - l);
  add(S, v, l);
  add(u, T, l);
}
int dis[N], q[N];
inline bool bfs() {
  memset(dis, inf, 4 * (T + 2));
  int f = 0, r = 1;
  q[f] = T;
  dis[T] = 0;
  while (f != r) {
    int u = q[f++];
    for (int i = head[u]; i != 0; i = nxt[i])
      if (cap[i ^ 1] && dis[to[i]] == inf) {
        q[r++] = to[i];
        dis[to[i]] = dis[u] + 1;
        if (to[i] == S) return 1;
      }
  }
  return dis[S] < inf;
}
inline int dfs(int u, int flow) {
  if (u == T || !flow) return flow;
  int res = 0;
  for (register int &i = cur[u]; i; i = nxt[i])
    if (cap[i] && dis[u] == dis[to[i]] + 1) {
      int tmp = dfs(to[i], min(flow, cap[i]));
      res += tmp;
      flow -= tmp;
      cap[i] -= tmp;
      cap[i ^ 1] += tmp;
      if (!flow) break;
    }
  return res;
}
inline int dinic() {
  int res = 0;
  while (bfs()) {
    memcpy(cur, head, 4 * (T + 2));
    res += dfs(S, inf);
  }
  return res;
}
int A[N], B[N], a[N], b[N];
map<int, int> m1, m2;
int c1[N], c2[N];
int t1, t2;
void ins(map<int, int> &Map, int *cnt, int &t, int x) {
  if (!Map.count(x)) Map[x] = ++t;
  cnt[Map[x]]++;
}
int main() {
  read(n);
  read(m);
  int rr, bb;
  read(rr);
  read(bb);
  for (register int i = 1; i <= n; i++)
    read(A[i]), read(B[i]), ins(m1, c1, t1, A[i]), ins(m2, c2, t2, B[i]);
  for (register int i = 1; i <= t1; i++) a[i] = c1[i];
  for (register int i = 1; i <= t2; i++) b[i] = c2[i];
  while (m--) {
    int op, l, d;
    read(op);
    read(l);
    read(d);
    if (op == 1)
      umin(a[m1[l]], d);
    else
      umin(b[m2[l]], d);
  }
  int s = t1 + t2 + 1, t = s + 1;
  S = t + 1;
  T = S + 1;
  for (register int i = 1; i <= t1; i++) {
    addedge(s, i, (c1[i] - a[i] + 1) / 2, (a[i] + c1[i]) / 2);
  }
  for (register int i = 1; i <= t2; i++) {
    addedge(t1 + i, t, (c2[i] - b[i] + 1) / 2, (b[i] + c2[i]) / 2);
  }
  static int e[N];
  for (register int i = 1; i <= n; i++) {
    e[i] = edgenum + 1, addedge(m1[A[i]], t1 + m2[B[i]], 0, 1);
  }
  addedge(t, s, 0, inf);
  dinic();
  for (int i = head[S]; i != 0; i = nxt[i])
    if (cap[i]) {
      puts("-1");
      return 0;
    }
  for (int i = head[T]; i != 0; i = nxt[i])
    if (cap[i ^ 1]) {
      puts("-1");
      return 0;
    }
  S = s;
  T = t;
  dinic();
  long long res = 0;
  static char ans[N];
  for (register int i = 1; i <= n; i++)
    if (!cap[e[i]])
      res += min(rr, bb), ans[i] = rr < bb ? 'r' : 'b';
    else
      res += max(rr, bb), ans[i] = rr < bb ? 'b' : 'r';
  printf("%lld\n", res);
  for (register int i = 1; i <= n; i++) printf("%c", ans[i]);
  return 0;
}