#include <bits/stdc++.h>
using namespace std;
const int Max_N(100050);
const int INF(0X3F3F3F3F);
namespace io {
const int SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c,
                                       qu[55];
int f, qr;
inline void flush() {
  fwrite(obuf, 1, oS - obuf, stdout);
  oS = obuf;
}
inline void putc(char x) {
  *oS++ = x;
  if (oS == oT) flush();
}
template <class I>
inline void gi(I &x) {
  for (f = 1, c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                            : *iS++);
       c < '0' || c > '9';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    if (c == '-') f = -1;
  for (x = 0; c <= '9' && c >= '0';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    x = x * 10 + (c & 15);
  x *= f;
}
template <class I>
inline void print(I x) {
  if (!x) putc('0');
  if (x < 0) putc('-'), x = -x;
  while (x) qu[++qr] = x % 10 + '0', x /= 10;
  while (qr) putc(qu[qr--]);
}
struct Flusher_ {
  ~Flusher_() { flush(); }
} io_flusher_;
}  // namespace io
using io::gi;
using io::print;
using io::putc;
inline void GG() { print(-1), exit(0); }
namespace G {
const int Max_V(300000);
const int Max_E(3000000);
int V, S, T, Head[Max_V], Total, To[Max_E], Next[Max_E], Cap[Max_E],
    Flow[Max_E];
inline void Add_Edge(int tot, int s, int t, int c) {
  To[tot] = t, Next[tot] = Head[s], Head[s] = tot, Cap[tot] = c, Flow[tot] = 0;
}
inline void Add_Link(int s, int t, int c) {
  Total += 2, Add_Edge(Total, s, t, c), Add_Edge(Total ^ 1, t, s, 0);
}
int Cur[Max_V], Q[Max_V], Dist[Max_V];
bool BFS() {
  int l, r;
  for (int i = 1; i <= V; ++i) Dist[i] = 0;
  Dist[Q[l = r = 1] = S] = 1;
  for (int u; l <= r;) {
    if ((u = Q[l++]) == T) return true;
    for (int i = Head[u], v; i; i = Next[i])
      if (!Dist[v = To[i]] && Cap[i] > Flow[i]) Dist[Q[++r] = v] = Dist[u] + 1;
  }
  return false;
}
int DFS(int u, int a) {
  if (u == T || a == 0) return a;
  int Ans(0);
  for (int &i = Cur[u], v, f; i; i = Next[i])
    if (Dist[v = To[i]] == Dist[u] + 1 &&
        (f = DFS(v, min(a, Cap[i] - Flow[i]))) > 0) {
      Ans += f, Flow[i] += f, Flow[i ^ 1] -= f;
      if ((a -= f) == 0) break;
    }
  return Ans;
}
int Dinic() {
  int Ans(0);
  while (BFS()) {
    for (int i = 1; i <= V; ++i) Cur[i] = Head[i];
    Ans += DFS(S, INF);
  }
  return Ans;
}
}  // namespace G
int N, M, R, B, X[Max_N], Y[Max_N], HX[Max_N], HY[Max_N], MX[Max_N], MY[Max_N],
    CX[Max_N], CY[Max_N], Num[Max_N], S, T, Limit;
inline void Add_Link(int s, int t, int l, int r) {
  if (r - l) G::Add_Link(s, t, r - l);
  if (l) G::Add_Link(G::S, t, l), G::Add_Link(s, G::T, l), Limit += l;
}
int main() {
  gi(N), gi(M);
  gi(R), gi(B);
  for (int i = 1; i <= N; ++i)
    gi(X[i]), gi(Y[i]), HX[++HX[0]] = X[i], HY[++HY[0]] = Y[i];
  sort(HX + 1, HX + 1 + HX[0]),
      HX[0] = unique(HX + 1, HX + 1 + HX[0]) - (HX + 1);
  sort(HY + 1, HY + 1 + HY[0]),
      HY[0] = unique(HY + 1, HY + 1 + HY[0]) - (HY + 1);
  for (int x = 1; x <= HX[0]; ++x) MX[x] = N;
  for (int y = 1; y <= HY[0]; ++y) MY[y] = N;
  for (int i = 1; i <= N; ++i) {
    ++CX[X[i] = lower_bound(HX + 1, HX + 1 + HX[0], X[i]) - HX];
    ++CY[Y[i] = lower_bound(HY + 1, HY + 1 + HY[0], Y[i]) - HY];
  }
  G::V = HX[0] + HY[0] + 2 + 2, G::S = HX[0] + HY[0] + 2 + 1,
  G::T = HX[0] + HY[0] + 2 + 2;
  S = HX[0] + HY[0] + 1, T = HX[0] + HY[0] + 2;
  for (int t, l, p, d; M--;) {
    gi(t), gi(l), gi(d);
    if (t == 1) {
      if (HX[p = lower_bound(HX + 1, HX + 1 + HX[0], l) - HX] == l)
        MX[p] = min(MX[p], d);
    } else {
      if (HY[p = lower_bound(HY + 1, HY + 1 + HY[0], l) - HY] == l)
        MY[p] = min(MY[p], d);
    }
  }
  for (int x = 1, l, r; x <= HX[0]; ++x) {
    l = max(0, (CX[x] - MX[x]) / 2 - 1);
    while (l - (CX[x] - l) < -MX[x]) ++l;
    r = min((MX[x] + CX[x]) / 2 + 1, CX[x]);
    while (r - (CX[x] - r) > +MX[x]) --r;
    if (l <= r)
      Add_Link(S, x, l, r);
    else
      GG();
  }
  for (int y = 1, l, r; y <= HY[0]; ++y) {
    l = max(0, (CY[y] - MY[y]) / 2 - 1);
    while (l - (CY[y] - l) < -MY[y]) ++l;
    r = min((MY[y] + CY[y]) / 2 + 1, CY[y]);
    while (r - (CY[y] - r) > +MY[y]) --r;
    if (l <= r)
      Add_Link(HX[0] + y, T, l, r);
    else
      GG();
  }
  for (int i = 1; i <= N; ++i)
    G::Add_Link(X[i], HX[0] + Y[i], 1), Num[i] = G::Total;
  G::Add_Link(T, S, INF);
  if (G::Dinic() < Limit) GG();
  int Ans = G::Flow[G::Total];
  G::Cap[G::Total] = G::Cap[G::Total + 1] = G::Flow[G::Total] =
      G::Flow[G::Total + 1] = 0;
  Ans += (G::S = S, G::T = T, G::Dinic());
  print(max(R, B) * 1LL * N - (max(R, B) - min(R, B)) * 1LL * Ans), putc('\n');
  for (int i = 1; i <= N; ++i)
    if (G::Flow[Num[i]])
      putc(R <= B ? 'r' : 'b');
    else
      putc(R <= B ? 'b' : 'r');
  return 0;
}
