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;
template <class T>
void read(T &x) {
  x = 0;
  bool flag = 0;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar()) flag |= ch == '-';
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - 48;
  flag ? x = ~x + 1 : 0;
}
int head[200010], cur[200010], tot = 1, q[200010], dep[200010];
struct edge {
  int v, c, next;
} e[2000010];
inline void insert(int u, int v, int c) {
  e[++tot].v = v, e[tot].c = c, e[tot].next = head[u];
  head[u] = tot;
}
inline void add(int u, int v, int c) { insert(u, v, c), insert(v, u, 0); }
inline bool bfs(int S, int T) {
  memset(dep, 0, sizeof dep);
  dep[S] = 1;
  int l = 1, r = 1;
  q[1] = S;
  while (l <= r) {
    int u = q[l++];
    for (int i = head[u], v; i; i = e[i].next)
      if (e[i].c && !dep[v = e[i].v]) {
        dep[v] = dep[u] + 1, q[++r] = v;
        if (v == T) return 1;
      }
  }
  return 0;
}
int dfs(int u, int dist, int T) {
  if (u == T) return dist;
  int ret = 0;
  for (int &i = head[u], v; i; i = e[i].next)
    if (dep[v = e[i].v] == dep[u] + 1 && e[i].c) {
      int d = dfs(v, min(dist - ret, e[i].c), T);
      e[i].c -= d, e[i ^ 1].c += d, ret += d;
      if (ret == dist) return dist;
    }
  if (!ret) dep[u] = -1;
  return ret;
}
int dinic(int S, int T) {
  int ret = 0;
  memcpy(cur, head, sizeof head);
  while (bfs(S, T)) ret += dfs(S, 0x3f3f3f3f, T), memcpy(head, cur, sizeof cur);
  return ret;
}
int x[200010], y[200010], a[2][200010], cnt[2], sum[2][200010], pos[200010],
    mx[2][200010], mn[2][200010], d[200010];
inline int get(int x, int y) {
  return lower_bound(a[y] + 1, a[y] + 1 + cnt[y], x) - a[y];
}
int main() {
  int n, m, r, b;
  read(n), read(m), read(r), read(b);
  for (int i = (1); i <= (n); i++)
    read(x[i]), read(y[i]), a[0][++cnt[0]] = x[i], a[1][++cnt[1]] = y[i];
  for (int i = (0); i <= (1); i++) {
    sort(a[i] + 1, a[i] + 1 + cnt[i]);
    cnt[i] = unique(a[i] + 1, a[i] + 1 + cnt[i]) - a[i] - 1;
  }
  int num = cnt[0] + cnt[1], SS = num + 1, TT = SS + 1, S = TT + 1, T = S + 1;
  for (int i = (1); i <= (n); i++) {
    sum[0][x[i] = get(x[i], 0)]++, sum[1][y[i] = get(y[i], 1)]++;
    add(x[i], y[i] + cnt[0], 1), pos[i] = tot - 1;
  }
  for (int i = (0); i <= (1); i++)
    for (int j = (1); j <= (cnt[i]); j++) mx[i][j] = sum[i][j];
  for (int i = (1); i <= (m); i++) {
    int t, l, d;
    read(t), read(l), read(d);
    t--;
    int l1 = get(l, t);
    if (a[t][l1] != l) continue;
    mx[t][l1] = min(mx[t][l1], (d + sum[t][l1]) / 2);
    mn[t][l1] = max(mn[t][l1], (sum[t][l1] - d + 1) / 2);
    if (mx[t][l1] < mn[t][l1]) {
      puts("-1");
      return 0;
    }
  }
  for (int i = (1); i <= (cnt[0]); i++) {
    add(SS, i, mx[0][i] - mn[0][i]);
    d[i] += mn[0][i], d[SS] -= mn[0][i];
  }
  for (int i = (1); i <= (cnt[1]); i++) {
    add(i + cnt[0], TT, mx[1][i] - mn[1][i]);
    d[i + cnt[0]] -= mn[1][i], d[TT] += mn[1][i];
  }
  add(TT, SS, 0x3f3f3f3f);
  int sum1 = 0;
  for (int i = (1); i <= (TT); i++)
    if (d[i] > 0)
      add(S, i, d[i]), sum1 += d[i];
    else
      add(i, T, -d[i]);
  int ans = dinic(S, T);
  if (ans ^ sum1) {
    puts("-1");
    return 0;
  }
  ans = dinic(SS, TT);
  printf("%lld\n", 1ll * ans * min(r, b) + 1ll * (n - ans) * max(r, b));
  for (int i = (1); i <= (n); i++)
    putchar(e[pos[i]].c ? (r < b ? 'b' : 'r') : (r < b ? 'r' : 'b'));
  return 0;
}