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 int read() {
  register int x = 0;
  register char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar();
  return x;
}
const int N = 2e5 + 5;
const int M = 4e6 + 5;
const int inf = INT_MAX;
struct each {
  int x, y;
} a[N];
queue<int> que;
int n, m, R, B, s, t, ss, tt, mx, my, ans, sum, now = 1;
int b[N], w[M], v[M], dis[N], cur[N], nex[M], tot[N], head[N];
void addedges(int x, int y, int z) {
  nex[++now] = head[x], v[now] = y;
  head[x] = now, w[now] = z;
}
void add(int x, int y, int z) {
  addedges(x, y, z);
  addedges(y, x, 0);
}
void add(int x, int y, int l, int r) {
  if (l > r) puts("-1"), exit(0);
  sum += l, add(x, t, l), add(s, y, l), add(x, y, r - l);
}
bool bfs(int s) {
  for (int i = 0; i <= s; i++) cur[i] = head[i];
  for (int i = 0; i < s; i++) dis[i] = 0;
  que.push(s), dis[s] = 1;
  while (!que.empty()) {
    int x = que.front();
    que.pop();
    for (int i = head[x]; i; i = nex[i])
      if (w[i] && !dis[v[i]]) {
        dis[v[i]] = dis[x] + 1;
        que.push(v[i]);
      }
  }
  return dis[t];
}
int dfs(int x, int f) {
  int ans = 0;
  if (x == t || !f) return f;
  for (int &i = cur[x]; i; i = nex[i])
    if (w[i] && dis[v[i]] == dis[x] + 1) {
      int d = dfs(v[i], min(f, w[i]));
      if (!d) continue;
      w[i] -= d, ans += d;
      w[i ^ 1] += d, f -= d;
      if (!f) break;
    }
  if (!ans) dis[x] = -1;
  return ans;
}
map<int, int> px, py;
void unique() {
  for (int i = 1; i <= n; i++) b[i] = a[i].x;
  sort(b + 1, b + n + 1), mx = unique(b + 1, b + n + 1) - b - 1;
  for (int i = 1; i <= n; i++)
    px[a[i].x] = lower_bound(b + 1, b + mx + 1, a[i].x) - b;
  for (int i = 1; i <= n; i++) b[i] = a[i].y;
  sort(b + 1, b + n + 1), my = unique(b + 1, b + n + 1) - b - 1;
  for (int i = 1; i <= n; i++)
    py[a[i].y] = lower_bound(b + 1, b + my + 1, a[i].y) - b;
  for (int i = 1; i <= n; i++) {
    add(px[a[i].x], py[a[i].y] + mx, 1);
    ++tot[px[a[i].x]], ++tot[py[a[i].y] + mx];
  }
  tt = mx + my + 1, ss = tt + 1, s = ss + 1;
}
char ch[2] = {'b', 'r'};
int _max[N];
int main() {
  n = read(), m = read(), R = read(), B = read();
  if (R > B) {
    swap(R, B);
    swap(ch[0], ch[1]);
  }
  for (int i = 1; i <= n; i++) a[i].x = read(), a[i].y = read();
  unique();
  for (int i = 1; i <= mx + my; i++) _max[i] = tot[i];
  while (m--) {
    int ty = read(), x = read(), y = read();
    if (ty == 1) {
      if (!px.count(x)) continue;
      x = px[x], _max[x] = min(_max[x], y);
    } else {
      if (!py.count(x)) continue;
      x = py[x] + mx, _max[x] = min(_max[x], y);
    }
  }
  for (int i = 1; i <= mx; i++)
    add(ss, i, (tot[i] - _max[i] + 1) >> 1, (tot[i] + _max[i]) >> 1);
  for (int i = mx + 1; i <= mx + my; i++)
    add(i, tt, (tot[i] - _max[i] + 1) >> 1, (tot[i] + _max[i]) >> 1);
  add(tt, ss, inf);
  while (bfs(s))
    while (int d = dfs(s, inf)) ans += d;
  s = ss, t = tt;
  while (bfs(s))
    while (dfs(s, inf))
      ;
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    if (w[i * 2])
      ans += B;
    else
      ans += R;
  printf("%lld\n", ans);
  for (int i = 1; i <= n; i++)
    if (w[i * 2])
      putchar(ch[0]);
    else
      putchar(ch[1]);
  return 0;
}