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;
int read() {
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    ;
  int x = ch - '0';
  for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
    x = x * 10 + ch - '0';
  return x;
}
const int N = 4e5 + 5, M = 2e6 + 5, inf = 0x7fffffff;
int t[M], nxt[M], f[M], lst[N], l;
void add(int x, int y, int z) {
  t[++l] = y;
  f[l] = z;
  nxt[l] = lst[x];
  lst[x] = l;
  t[++l] = x;
  f[l] = 0;
  nxt[l] = lst[y];
  lst[y] = l;
}
int n, m, r, b, S, T, ss, tt, x[N], y[N], bx[N], by[N], ox, oy, cnt[N], used[N];
int lim[N];
void link(int x, int y, int d, int u) {
  if (d > u) {
    puts("-1");
    exit(0);
  }
  used[y] += d;
  used[x] -= d;
  if (u - d) add(x, y, u - d);
}
int dis[N], q[N];
bool bfs(int S, int T) {
  for (int i = 0; i <= ox + oy + 3; i++) dis[i] = 0;
  dis[S] = 1;
  int i = 0, j = 1;
  q[1] = S;
  while (i < j) {
    for (int k = lst[q[++i]]; k; k = nxt[k])
      if (f[k] && !dis[t[k]]) {
        dis[t[k]] = dis[q[i]] + 1;
        q[++j] = t[k];
      }
  }
  return dis[T];
}
int dinic(int x, int y, int T) {
  if (x == T) return y;
  int now = 0;
  for (int i = lst[x]; i; i = nxt[i])
    if (f[i] && dis[t[i]] == dis[x] + 1) {
      int k = dinic(t[i], min(y, f[i]), T);
      f[i] -= k;
      f[i ^ 1] += k;
      y -= k;
      now += k;
      if (!y) break;
    }
  if (!now) dis[x] = -1;
  return now;
}
int max_flow(int S, int T) {
  int ans = 0;
  while (bfs(S, T)) ans += dinic(S, inf, T);
  return ans;
}
int main() {
  n = read();
  m = read();
  r = read();
  b = read();
  l = 1;
  for (int i = 1; i <= n; i++) x[i] = read(), y[i] = read();
  for (int i = 1; i <= n; i++) bx[i] = x[i];
  sort(bx + 1, bx + n + 1);
  ox = unique(bx + 1, bx + n + 1) - bx - 1;
  for (int i = 1; i <= n; i++) by[i] = y[i];
  sort(by + 1, by + n + 1);
  oy = unique(by + 1, by + n + 1) - by - 1;
  S = 0;
  T = ox + oy + 1;
  ss = ox + oy + 2;
  tt = ox + oy + 3;
  for (int i = 1; i <= n; i++) {
    int a = lower_bound(bx + 1, bx + ox + 1, x[i]) - bx;
    int b = lower_bound(by + 1, by + oy + 1, y[i]) - by;
    add(a, b + ox, 1);
    cnt[a]++;
    cnt[b + ox]++;
  }
  for (int i = 1; i <= ox + oy; i++) lim[i] = cnt[i];
  for (int i = 1; i <= m; i++) {
    int t = read(), w = read(), d = read();
    if (t == 1) {
      int a = lower_bound(bx + 1, bx + ox + 1, w) - bx;
      if (bx[a] == w) lim[a] = min(lim[a], d);
    } else {
      int b = lower_bound(by + 1, by + oy + 1, w) - by;
      if (by[b] == w) lim[b + ox] = min(lim[b + ox], d);
    }
  }
  int sum = 0;
  for (int i = 1; i <= ox; i++) {
    link(S, i, (cnt[i] - lim[i] + 1) >> 1, (cnt[i] + lim[i]) >> 1);
    sum += (cnt[i] - lim[i] + 1) >> 1;
  }
  for (int i = ox + 1; i <= ox + oy; i++)
    link(i, T, (cnt[i] - lim[i] + 1) >> 1, (cnt[i] + lim[i]) >> 1);
  add(T, S, inf);
  for (int i = S; i <= T; i++)
    if (used[i] > 0)
      add(ss, i, used[i]);
    else
      add(i, tt, -used[i]);
  int flow = max_flow(ss, tt);
  if (flow < sum) {
    puts("-1");
    return 0;
  }
  lst[ss] = lst[tt] = 0;
  flow = max_flow(S, T);
  char big = 'r', small = 'b';
  if (r < b) swap(big, small), swap(r, b);
  printf("%lld\n", (long long)b * flow + (long long)r * (n - flow));
  for (int i = 1; i <= n; i++) putchar(f[i << 1] ? big : small);
  return 0;
}