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 <typename T>
void read(T &x) {
  x = 0;
  bool f = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 1;
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  if (f) x = -x;
}
template <typename F>
inline void write(F x, char ed = '\n') {
  static short st[30];
  short tp = 0;
  if (x < 0) putchar('-'), x = -x;
  do st[++tp] = x % 10, x /= 10;
  while (x);
  while (tp) putchar('0' | st[tp--]);
  putchar(ed);
}
template <typename T>
inline void Mx(T &x, T y) {
  x < y && (x = y);
}
template <typename T>
inline void Mn(T &x, T y) {
  x > y && (x = y);
}
namespace Flows {
const int M = 2005500;
int cur[M], h[M], dep[M], ne[M], to[M], cnt, s, t, tot = 1;
long long w[M];
inline void add(int x, int y, long long z) {
  ne[++tot] = h[x], to[h[x] = tot] = y, w[tot] = z;
}
inline void adde(int x, int y, long long z) { add(x, y, z), add(y, x, 0); }
long long dfs(int x, long long lim) {
  if (!lim || x == t) return lim;
  long long res = 0, fl;
  for (int &i = cur[x], y; i; i = ne[i]) {
    if (dep[y = to[i]] != dep[x] + 1 || !w[i]) continue;
    fl = dfs(y, min(lim, w[i]));
    lim -= fl, res += fl;
    w[i] -= fl, w[i ^ 1] += fl;
    if (!lim) return res;
  }
  return res;
}
queue<int> q;
bool bfs(void) {
  memset(dep, 0, cnt * 4 + 20);
  dep[s] = 1, q.push(s);
  while (q.size()) {
    int x = q.front();
    q.pop();
    for (int i = h[x], y; i; i = ne[i])
      if (!dep[y = to[i]] && w[i]) dep[y] = dep[x] + 1, q.push(y);
  }
  if (!dep[t]) return 0;
  memcpy(cur, h, cnt * 4 + 20);
  return 1;
}
inline void del(int x) { h[x] = ne[h[x]]; }
int flow(void) {
  int ans = 0;
  while (bfs()) ans += dfs(s, 1e15);
  return ans;
}
}  // namespace Flows
using Flows::adde;
using Flows::cnt;
using Flows::del;
using Flows::flow;
using Flows::s;
using Flows::t;
const int N = 405000;
struct node {
  int c, up, dw;
} c1[N], c2[N];
int c[N], tt, m, n, rc, bc, x[N], y[N];
void update(node &x, int d) {
  int L = (x.c - d + 1) >> 1, R = (x.c + d) >> 1;
  if (L > R) {
    write(-1), exit(0);
  }
  Mx(x.dw, L), Mn(x.up, R);
}
long long deg[N];
int main() {
  read(n), read(m), read(rc), read(bc);
  char r = 'r', b = 'b';
  if (rc > bc) swap(rc, bc), swap(r, b);
  for (int i = 1; i <= n; ++i)
    read(x[i]), read(y[i]), c[++tt] = x[i], c[++tt] = y[i];
  sort(c + 1, c + tt + 1), tt = unique(c + 1, c + tt + 1) - c - 1;
  for (int i = 1; i <= n; ++i) {
    x[i] = lower_bound(c + 1, c + tt + 1, x[i]) - c;
    y[i] = lower_bound(c + 1, c + tt + 1, y[i]) - c;
    c1[x[i]].c++, c2[y[i]].c++;
  }
  for (int i = 1; i <= tt; ++i) c1[i].up = c2[i].up = 1e9;
  for (int i = 1, op, x, d; i <= m; ++i) {
    read(op), read(x), read(d);
    int k = lower_bound(c + 1, c + tt + 1, x) - c;
    if (c[k] != x) continue;
    if (op == 1)
      update(c1[k], d);
    else
      update(c2[k], d);
  }
  int nd = 0, ss, ttt;
  cnt = 2 * tt, s = ++cnt, t = ++cnt, ss = ++cnt, ttt = ++cnt;
  for (int i = 1; i <= n; ++i) adde(x[i], y[i] + tt, 1);
  long long Sc = 0, Tc = 0;
  for (int i = 1; i <= tt; ++i) {
    int t1 = c1[i].up - c1[i].dw;
    int t2 = c2[i].up - c2[i].dw;
    adde(s, i, t1), adde(i + tt, t, t2);
    int d1 = c1[i].dw, d2 = c2[i].dw;
    Sc += d1, Tc += d2, nd += d1 + d2;
    adde(ss, i, d1), adde(i + tt, ttt, d2);
  }
  adde(ss, t, Tc), adde(s, ttt, Sc);
  adde(t, s, 1e9);
  int S = s, T = t;
  s = ss, t = ttt;
  int res = flow();
  if (res != nd) return write(-1), 0;
  int tp = Flows::w[Flows::tot];
  s = S, t = T, del(s), del(t), del(s), del(t);
  tp += flow();
  write(1ll * tp * rc + 1ll * (n - tp) * bc);
  Flows::tot = 1;
  for (int i = 1; i <= n; ++i) {
    Flows::tot += 2;
    putchar(Flows::w[Flows::tot] ? r : b);
  }
  return 0;
}