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;
map<int, int> mpx, mpy;
struct str {
  int v, nex, cap;
} edge[2010000];
int sing[101000], markx[101000], marky[101000], numx[101000], numy[101000],
    Lx[101000], Rx[101000], Ly[101000], Ry[101000];
int fst[101000 << 1], vis[101000 << 1], d[101000 << 1], que[101000 << 1];
int e = 1, tpx, tpy, top, s, t, S, T, cl, n, m, E;
int Flow, X, Y;
long long ans;
char C[2] = {'r', 'b'};
void make_edge(int a, int b, int cap) {
  edge[++e].nex = fst[a];
  fst[a] = e;
  edge[e].v = b;
  edge[e].cap = cap;
  edge[++e].nex = fst[b];
  fst[b] = e;
  edge[e].v = a;
  edge[e].cap = 0;
}
bool bfs(int s, int t, int E) {
  int L = 0, R = 0;
  que[++R] = s;
  vis[s] = ++cl;
  d[s] = 0;
  while (L < R) {
    int u = que[++L];
    for (int i = fst[u]; i; i = edge[i].nex) {
      int v = edge[i].v;
      if (i <= E && edge[i].cap && vis[v] != cl) {
        d[v] = d[u] + 1;
        vis[v] = cl;
        que[++R] = v;
      }
    }
  }
  return (vis[t] == cl);
}
int dfs(int u, int ma, int s, int t, int E) {
  if (!ma || u == t) return ma;
  int f, flow = 0;
  for (int i = fst[u]; i; i = edge[i].nex) {
    int v = edge[i].v;
    if (d[v] == d[u] + 1 && i <= E &&
        (f = dfs(v, min(ma, edge[i].cap), s, t, E))) {
      flow += f;
      ma -= f;
      edge[i].cap -= f;
      edge[i ^ 1].cap += f;
      if (!ma) return flow;
    }
  }
  d[u] = (1 << 30);
  return flow;
}
void dinic(int s, int t, int E) {
  Flow = 0;
  while (bfs(s, t, E)) Flow += dfs(s, (1 << 30), s, t, E);
}
int main() {
  scanf("%d %d", &n, &m);
  scanf("%d %d", &X, &Y);
  if (X < Y) swap(X, Y), swap(C[0], C[1]);
  ans = (long long)X * (long long)n;
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (!mpx[x]) mpx[x] = ++tpx, markx[tpx] = ++top;
    if (!mpy[y]) mpy[y] = ++tpy, marky[tpy] = ++top;
    numx[mpx[x]]++;
    numy[mpy[y]]++;
    make_edge(markx[mpx[x]], marky[mpy[y]], 1);
    sing[i] = e;
  }
  s = ++top;
  t = ++top;
  S = ++top;
  T = ++top;
  for (int i = 1; i <= tpx; i++) Lx[i] = 0, Rx[i] = numx[i];
  for (int i = 1; i <= tpy; i++) Ly[i] = 0, Ry[i] = numy[i];
  for (int i = 1; i <= m; i++) {
    int t, a, b, u;
    scanf("%d %d %d", &t, &a, &b);
    if (t == 1) {
      if (!numx[u = mpx[a]]) continue;
      Lx[u] = max(Lx[u], (numx[u] - b + 1) / 2);
      Rx[u] = min(Rx[u], (numx[u] + b) / 2);
    } else {
      if (!numy[u = mpy[a]]) continue;
      Ly[u] = max(Ly[u], (numy[u] - b + 1) / 2);
      Ry[u] = min(Ry[u], (numy[u] + b) / 2);
    }
  }
  for (int i = 1; i <= tpx; i++)
    if (Lx[i] > Rx[i]) {
      printf("-1");
      return 0;
    }
  for (int i = 1; i <= tpy; i++)
    if (Ly[i] > Ry[i]) {
      printf("-1");
      return 0;
    }
  for (int i = 1; i <= tpx; i++) make_edge(s, markx[i], Rx[i] - Lx[i]);
  for (int i = 1; i <= tpy; i++) make_edge(marky[i], t, Ry[i] - Ly[i]);
  E = e;
  make_edge(t, s, (1 << 30));
  int jsx = 0;
  for (int i = 1; i <= tpx; i++) {
    make_edge(S, markx[i], Lx[i]);
    jsx += Lx[i];
  }
  make_edge(s, T, jsx);
  int jsy = 0;
  for (int i = 1; i <= tpy; i++) {
    make_edge(marky[i], T, Ly[i]);
    jsy += Ly[i];
  }
  make_edge(S, t, jsy);
  dinic(S, T, e);
  if (Flow != jsx + jsy) {
    printf("-1");
    return 0;
  }
  dinic(s, t, E);
  Flow = 0;
  for (int i = fst[s]; i; i = edge[i].nex) {
    if (edge[i].v == t) continue;
    Flow += edge[i ^ 1].cap;
  }
  ans -= (long long)Flow * (long long)(X - Y);
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    if (edge[sing[i]].cap)
      putchar(C[1]);
    else
      putchar(C[0]);
  }
  return 0;
}