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>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
}
using namespace std;
const long long inf = 1e9 + 1000000;
inline void MIN(long long &a, long long b) {
  if (b < a) a = b;
}
inline void MAX(long long &a, long long b) {
  if (b > a) a = b;
}
long long n, m, R, B, s, t, S, T;
long long X[201000], Y[201000], hx[201000], hy[201000], xtot, ytot;
vector<long long> r[201000], c[201000];
long long mnjuer[201000], mnjuec[201000];
struct edge {
  long long nxt, to, val;
  edge() {}
  edge(long long jzp, long long zzz, long long lsr) {
    nxt = jzp, to = zzz, val = lsr;
  }
} e[2001000];
long long head[201000], ecnt = 1, hcur[201000];
inline void addedge(long long from, long long to, long long val) {
  e[++ecnt] = edge(head[from], to, val);
  head[from] = ecnt;
}
inline void Addedge(long long u, long long v, long long w) {
  addedge(u, v, w), addedge(v, u, 0);
}
long long dep[201000], que[201000], front, rear;
inline bool bfs(long long s, long long t) {
  memset(dep, 0x3f, sizeof(dep));
  front = rear = 0;
  for (long long i = 1; i <= T; ++i) hcur[i] = head[i];
  dep[s] = 0;
  que[++rear] = s;
  while (front < rear) {
    long long cur = que[++front];
    for (long long i = head[cur]; i; i = e[i].nxt) {
      long long to = e[i].to;
      if (!e[i].val || dep[to] < inf) continue;
      dep[to] = dep[cur] + 1;
      que[++rear] = to;
    }
  }
  return dep[t] < inf;
}
long long dfs(long long cur, long long limi, long long t) {
  if (cur == t || !limi) return limi;
  long long flow = 0;
  for (long long i = hcur[cur]; i; i = e[i].nxt) {
    long long to = e[i].to;
    hcur[cur] = i;
    if (dep[to] != dep[cur] + 1) continue;
    long long tmp = dfs(to, min(e[i].val, limi), t);
    if (!tmp) continue;
    e[i].val -= tmp;
    e[i ^ 1].val += tmp;
    flow += tmp;
    limi -= tmp;
    if (!limi) break;
  }
  return flow;
}
long long eid[201000], in[201000], out[201000];
char chr[201000];
signed main() {
  read(n), read(m);
  read(R), read(B);
  char ch[2] = {'r', 'b'};
  if (R < B) swap(R, B), swap(ch[0], ch[1]);
  long long ans = 1ll * R * n;
  for (long long i = 1; i <= n; ++i) {
    read(X[i]), read(Y[i]);
    hx[++xtot] = X[i];
    hy[++ytot] = Y[i];
  }
  sort(hx + 1, hx + 1 + n);
  xtot = unique(hx + 1, hx + 1 + n) - hx - 1;
  sort(hy + 1, hy + 1 + n);
  ytot = unique(hy + 1, hy + 1 + n) - hy - 1;
  for (long long i = 1; i <= n; ++i) {
    X[i] = lower_bound(hx + 1, hx + 1 + xtot, X[i]) - hx;
    Y[i] = lower_bound(hy + 1, hy + 1 + ytot, Y[i]) - hy;
    r[X[i]].push_back(i);
    c[Y[i]].push_back(i);
  }
  memset(mnjuer, 0x3f, sizeof(mnjuer));
  memset(mnjuec, 0x3f, sizeof(mnjuec));
  for (long long i = 1; i <= m; ++i) {
    long long t, l, d;
    read(t), read(l), read(d);
    if (t == 1) {
      long long jzp = lower_bound(hx + 1, hx + 1 + xtot, l) - hx;
      if (hx[jzp] == l) MIN(mnjuer[jzp], d);
    } else {
      long long jzp = lower_bound(hy + 1, hy + 1 + ytot, l) - hy;
      if (hy[jzp] == l) MIN(mnjuec[jzp], d);
    }
  }
  s = xtot + ytot + 1, t = s + 1;
  S = t + 1, T = S + 1;
  for (long long i = 1; i <= xtot; ++i) {
    long long sz = r[i].size(), l = mnjuer[i];
    if (l >= sz) {
      Addedge(s, i, inf);
    } else {
      long long d = (sz - l + 1) >> 1, u = (sz + l) >> 1;
      if (d > u) {
        puts("-1");
        return 0;
      }
      Addedge(s, i, u - d);
      out[s] += d;
      in[i] += d;
    }
  }
  for (long long i = 1; i <= ytot; ++i) {
    long long sz = c[i].size(), l = mnjuec[i];
    if (l > inf) {
      Addedge(xtot + i, t, inf);
    } else {
      long long d = (sz - l + 1) >> 1, u = (sz + l) >> 1;
      if (d > u) {
        puts("-1");
        return 0;
      }
      Addedge(xtot + i, t, u - d);
      out[xtot + i] += d;
      in[t] += d;
    }
  }
  for (long long i = 1; i <= n; ++i)
    Addedge(X[i], xtot + Y[i], 1), eid[i] = ecnt ^ 1;
  Addedge(t, s, inf);
  long long memoe = ecnt;
  long long jzp = 0;
  for (long long i = 1; i <= t; ++i)
    if (in[i] > out[i])
      Addedge(S, i, in[i] - out[i]), jzp += in[i] - out[i];
    else
      Addedge(i, T, out[i] - in[i]);
  long long mxflow = 0;
  while (bfs(S, T)) mxflow += dfs(S, inf, T);
  if (mxflow != jzp) {
    puts("-1");
    return 0;
  }
  e[memoe].val = e[memoe ^ 1].val = 0;
  for (long long i = head[S]; i; i = e[i].nxt) e[i].val = e[i ^ 1].val = 0;
  for (long long i = head[T]; i; i = e[i].nxt) e[i].val = e[i ^ 1].val = 0;
  while (bfs(s, t)) mxflow += dfs(s, inf, t);
  for (long long i = 1; i <= n; ++i)
    if (e[eid[i]].val)
      chr[i] = ch[0];
    else
      chr[i] = ch[1], ans -= R - B;
  printf("%lld\n", ans);
  puts(chr + 1);
  return 0;
}