#include <bits/stdc++.h>
using namespace std;
int IN() {
  int x = 0, f = 0, ch;
  for (; (ch = getchar()) < '0' || ch > '9';) f = (ch == '-');
  for (; ch >= '0' && ch <= '9'; (ch = getchar())) x = x * 10 + ch - '0';
  return f ? -x : x;
}
int N, M, C1, C2, ID[100005], Ans[100005];
int X[100005], Y[100005], LX[100005], LY[100005], RX[100005], RY[100005],
    NX[100005], NY[100005];
struct Nod {
  int x, y;
} A[100005];
namespace Flow {
int C, D, S, T, ss, tt, st[1000005], Q[1000005], Dis[1000005], G[1000005];
struct Lin {
  int v, next, f;
} E[1000005];
void Link(int u, int v, int f) {
  if (!f) return;
  E[++D] = (Lin){v, st[u], f};
  st[u] = D;
  E[++D] = (Lin){u, st[v], 0};
  st[v] = D;
}
bool BFS() {
  for (int i = 1, lim = C; i <= lim; i++) Dis[i] = -1;
  Dis[Q[1] = ss] = 0;
  for (int l = 0, r = 1; l < r;) {
    int u = Q[++l];
    for (int i = st[u], v; i; i = E[i].next)
      if (E[i].f && Dis[v = E[i].v] == -1) {
        Dis[Q[++r] = v] = Dis[u] + 1;
        if (v == tt) return 1;
      }
  }
  return 0;
}
int DFS(int u, int Lim) {
  if (u == tt) return Lim;
  int ret = 0;
  for (int i = st[u], v; i; i = E[i].next)
    if (E[i].f && Dis[u] + 1 == Dis[v = E[i].v]) {
      int t = DFS(v, min(Lim - ret, E[i].f));
      if (t) {
        E[i].f -= t;
        E[i ^ 1].f += t;
        ret += t;
        if (ret == Lim) break;
      } else
        Dis[v] = -1;
    }
  return ret;
}
bool check(int w) {
  C = *X + *Y;
  S = ++C;
  T = ++C;
  ss = ++C;
  tt = ++C;
  for (int i = 1, lim = C; i <= lim; i++) st[i] = G[i] = 0;
  D = 1;
  int tot = 0;
  for (int i = 1, lim = *X; i <= lim; i++)
    Link(S, i, RX[i]), G[S] += LX[i], G[i] -= LX[i], tot += LX[i];
  for (int i = 1, lim = *Y; i <= lim; i++)
    Link(*X + i, T, RY[i]), G[*X + i] += LY[i], G[T] -= LY[i], tot += LY[i];
  for (int i = 1, lim = N; i <= lim; i++)
    Link(A[i].x, *X + A[i].y, 1), ID[i] = D;
  Link(T, S, w);
  for (int i = 1, lim = C; i <= lim; i++) {
    if (G[i] > 0) Link(i, tt, G[i]);
    if (G[i] < 0) Link(ss, i, -G[i]);
  }
  int flow = 0;
  for (; BFS();) flow += DFS(ss, (1 << 30));
  for (int i = 1, lim = N; i <= lim; i++) Ans[i] = E[ID[i]].f;
  return flow == tot;
}
int Main() {
  int L = -1, R = N + 1;
  for (; L + 1 < R;) {
    int Mid = (L + R) >> 1;
    if (check(Mid))
      R = Mid;
    else
      L = Mid;
  }
  check(R);
  return R;
}
};  // namespace Flow
int main(int argc, char* argv[]) {
  N = IN();
  M = IN();
  C1 = IN();
  C2 = IN();
  for (int i = 1, lim = N; i <= lim; i++)
    A[i] = (Nod){IN(), IN()}, X[++*X] = A[i].x, Y[++*Y] = A[i].y;
  sort(X + 1, X + *X + 1);
  *X = unique(X + 1, X + *X + 1) - X - 1;
  sort(Y + 1, Y + *Y + 1);
  *Y = unique(Y + 1, Y + *Y + 1) - Y - 1;
  for (int i = 1, lim = N; i <= lim; i++) {
    A[i].x = lower_bound(X + 1, X + *X + 1, A[i].x) - X;
    A[i].y = lower_bound(Y + 1, Y + *Y + 1, A[i].y) - Y;
    LX[i] = LY[i] = N;
    NX[A[i].x]++;
    NY[A[i].y]++;
  }
  for (int i = 1, lim = M; i <= lim; i++) {
    int t = IN(), k = IN(), d = IN();
    if (t == 1) {
      int x = lower_bound(X + 1, X + *X + 1, k) - X;
      if (X[x] == k) LX[x] = min(LX[x], d);
    } else {
      int y = lower_bound(Y + 1, Y + *Y + 1, k) - Y;
      if (Y[y] == k) LY[y] = min(LY[y], d);
    }
  }
  int GTW = 0;
  for (int i = 1, lim = *X; i <= lim; i++) {
    int d = LX[i];
    if (d >= NX[i])
      LX[i] = 0, RX[i] = N;
    else {
      LX[i] = (NX[i] - d + 1) / 2;
      RX[i] = (NX[i] + d) / 2;
      RX[i] -= LX[i];
      if (RX[i] < 0) GTW = 1;
    }
  }
  for (int i = 1, lim = *Y; i <= lim; i++) {
    int d = LY[i];
    if (d >= NY[i])
      LY[i] = 0, RY[i] = N;
    else {
      LY[i] = (NY[i] - d + 1) / 2;
      RY[i] = (NY[i] + d) / 2;
      RY[i] -= LY[i];
      if (RY[i] < 0) GTW = 1;
    }
  }
  if (GTW) return puts("-1");
  int ret = Flow::Main();
  if (ret == N + 1)
    puts("-1");
  else {
    int flag = 0;
    if (C1 > C2) swap(C1, C2), flag = 1;
    printf("%lld\n", 1ll * C1 * (N - ret) + 1ll * C2 * ret);
    for (int i = 1, lim = N; i <= lim; i++)
      Ans[i] ^= flag, putchar(Ans[i] ? 'b' : 'r');
  }
  puts("");
  fprintf(stderr, "%d\n", ret);
  return 0;
}
