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
#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *l = buf, *r = buf;
  return l == r && (r = (l = buf) + fread(buf, 1, 100000, stdin), l == r)
             ? EOF
             : *l++;
}
template <class T>
void rd(T &x) {
  x = 0;
  int f = 1, ch = gc();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = gc();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 - '0' + ch;
    ch = gc();
  }
  x *= f;
}
template <class T>
inline bool Cmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
const int inf = 1e9;
const int maxn = 100000 + 50;
const int maxnode = maxn << 1;
int n, m, r, b, x[maxn], y[maxn];
char R, B;
int px, py, Hx[maxn], Hy[maxn];
int mn[maxnode], D[maxnode];
int s, t, ss, tt;
int head[maxnode], deg[maxnode];
struct edge {
  int to, nex, cap, flow;
  edge(int to = 0, int nex = 0, int cap = 0, int flow = 0)
      : to(to), nex(nex), cap(cap), flow(flow) {}
};
vector<edge> G;
inline void addedge(int u, int v, int c) {
  G.push_back(edge(v, head[u], c)), head[u] = G.size() - 1;
  G.push_back(edge(u, head[v], 0)), head[v] = G.size() - 1;
  ++deg[u], ++deg[v];
}
inline void popedge(int u, int v) {
  head[v] = G.back().nex;
  G.pop_back();
  head[u] = G.back().nex;
  G.pop_back();
}
namespace dinic {
int st, ed, cur[maxnode], dis[maxnode];
bool BFS() {
  static int q[maxnode];
  int hd = 0, tl = 0;
  memset(dis, -1, sizeof(dis));
  q[tl++] = st, dis[st] = 1;
  while (hd < tl) {
    int u = q[hd++];
    for (int i = head[u]; ~i; i = G[i].nex)
      if (G[i].cap > G[i].flow) {
        int v = G[i].to;
        if (dis[v] == -1) {
          dis[v] = dis[u] + 1;
          q[tl++] = v;
        }
      }
  }
  return dis[ed] != -1;
}
int dfs(int u, int flow) {
  if (u == ed || !flow) return flow;
  int t = flow;
  for (int &i = cur[u]; ~i; i = G[i].nex) {
    int v = G[i].to;
    if (dis[v] == dis[u] + 1) {
      int d = dfs(v, min(flow, G[i].cap - G[i].flow));
      G[i].flow += d, G[i ^ 1].flow -= d;
      flow -= d;
      if (flow == 0) break;
    }
  }
  return t - flow;
}
int maxflow(int s, int t) {
  st = s, ed = t;
  int flow = 0;
  while (BFS()) {
    memcpy(cur, head, sizeof(cur));
    flow += dfs(st, inf);
  }
  return flow;
}
}  // namespace dinic
int main() {
  rd(n), rd(m);
  rd(r), rd(b), R = 'r', B = 'b';
  if (r > b) swap(r, b), swap(R, B);
  for (int i = 1; i <= n; ++i) {
    rd(x[i]), rd(y[i]);
    Hx[++px] = x[i];
    Hy[++py] = y[i];
  }
  sort(Hx + 1, Hx + px + 1), px = unique(Hx + 1, Hx + px + 1) - Hx - 1;
  sort(Hy + 1, Hy + py + 1), py = unique(Hy + 1, Hy + py + 1) - Hy - 1;
  for (int i = 1; i <= px + py; ++i) mn[i] = n;
  for (int i = 1; i <= m; ++i) {
    int t, l, d;
    rd(t), rd(l), rd(d);
    if (t == 1) {
      int t = lower_bound(Hx + 1, Hx + px + 1, l) - Hx;
      if (Hx[t] != l) continue;
      Cmin(mn[t], d);
    } else {
      int t = lower_bound(Hy + 1, Hy + py + 1, l) - Hy;
      if (Hy[t] != l) continue;
      Cmin(mn[t + px], d);
    }
  }
  s = 0, t = px + py + 1, ss = t + 1, tt = ss + 1;
  memset(head, -1, sizeof(head));
  for (int i = 1; i <= n; ++i) {
    x[i] = lower_bound(Hx + 1, Hx + px + 1, x[i]) - Hx;
    y[i] = lower_bound(Hy + 1, Hy + py + 1, y[i]) - Hy;
    addedge(x[i], px + y[i], 1);
  }
  for (int i = 1; i <= px + py; ++i) {
    int d = mn[i], sz = deg[i];
    int l = max(0, (sz - d + 1) / 2), r = min(sz, (sz + d) / 2);
    if (l > r) {
      puts("-1");
      return 0;
    }
    if (i <= px) {
      addedge(s, i, r - l);
      D[s] -= l, D[i] += l;
    } else {
      addedge(i, t, r - l);
      D[i] -= l, D[t] += l;
    }
  }
  int sum = 0;
  for (int i = s; i <= t; ++i) {
    if (D[i] > 0) addedge(ss, i, D[i]), sum += D[i];
    if (D[i] < 0) addedge(i, tt, -D[i]);
  }
  addedge(t, s, inf);
  if (dinic::maxflow(ss, tt) != sum) {
    puts("-1");
    return 0;
  }
  int an = G[G.size() - 2].flow;
  popedge(t, s);
  for (int i = t; i >= s; --i) {
    if (D[i] > 0) popedge(ss, i);
    if (D[i] < 0) popedge(i, tt);
  }
  an -= dinic::maxflow(t, s);
  printf("%lld\n", (long long)an * b + (long long)(n - an) * r);
  for (int i = 0; i < n; ++i) printf("%c", G[i << 1].flow == 1 ? B : R);
  return 0;
}
