#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mxN = 200005, mxM = 2000005, INF = 0x3f3f3f3f;
struct graph {
  int S, T;
  int base[mxN], vec[mxM], pre[mxM], tot;
  long long c[mxM];
  int d[mxN], q[mxN];
  bool vis[mxN];
  void init() {
    memset(base, 0, sizeof(base));
    tot = 1;
  }
  int link(int x, int y, long long z) {
    vec[++tot] = y;
    pre[tot] = base[x];
    base[x] = tot;
    c[tot] = z;
    vec[++tot] = x;
    pre[tot] = base[y];
    base[y] = tot;
    c[tot] = 0;
    return tot - 1;
  }
  bool bfs() {
    int head = 0, tail = 0;
    memset(d, -1, sizeof(d));
    d[S] = 0;
    q[++tail] = S;
    while (head < tail) {
      head++;
      int u = q[head];
      for (int now = base[u]; now; now = pre[now]) {
        int v = vec[now];
        if (d[v] == -1 && c[now] > 0) {
          d[v] = d[u] + 1;
          q[++tail] = v;
          if (v == T) return 1;
        }
      }
    }
    return 0;
  }
  long long dfs(int u, long long flow) {
    long long r = 0;
    if (u == T) return flow;
    for (int now = base[u]; now && r < flow; now = pre[now]) {
      int v = vec[now];
      if (c[now] > 0 && d[v] == d[u] + 1) {
        long long x = min(c[now], flow - r);
        x = dfs(v, x);
        r += x;
        c[now] -= x;
        c[now ^ 1] += x;
      }
    }
    if (!r) d[u] = -2;
    return r;
  }
  long long dinic() {
    long long ans = 0;
    while (bfs()) ans += dfs(S, INF);
    return ans;
  }
} G;
struct P {
  int x, y;
} a[N];
int mx[N], my[N], R, C;
int id[N];
int down[N], up[N];
long long in[N], out[N];
int cnt[N];
int getx(int x) { return lower_bound(mx + 1, mx + R + 1, x) - mx; }
int gety(int y) { return lower_bound(my + 1, my + C + 1, y) - my; }
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int r, b;
  scanf("%d%d", &r, &b);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    mx[i] = a[i].x;
    my[i] = a[i].y;
  }
  sort(mx + 1, mx + n + 1);
  R = unique(mx + 1, mx + n + 1) - (mx + 1);
  sort(my + 1, my + n + 1);
  C = unique(my + 1, my + n + 1) - (my + 1);
  for (int i = 1; i <= R + C; i++) down[i] = 0, up[i] = INF;
  G.init();
  for (int i = 1; i <= n; i++) {
    int x = getx(a[i].x);
    int y = gety(a[i].y);
    id[i] = G.link(x, R + y, 1);
    cnt[x]++;
    cnt[R + y]++;
  }
  while (m--) {
    int t, l, d;
    scanf("%d%d%d", &t, &l, &d);
    int p = l;
    if (t == 1) {
      l = getx(l);
      if (mx[l] != p) continue;
      int num = cnt[l];
      int dow = (num - d + 1) / 2, upp = (num + d) / 2;
      down[l] = max(down[l], dow);
      up[l] = min(up[l], upp);
    }
    if (t == 2) {
      l = gety(l);
      if (my[l] != p) continue;
      int num = cnt[R + l];
      int dow = (num - d + 1) / 2, upp = (num + d) / 2;
      down[R + l] = max(down[R + l], dow);
      up[R + l] = min(up[R + l], upp);
    }
  }
  for (int i = 1; i <= R + C; i++)
    if (down[i] > up[i]) {
      printf("-1\n");
      return 0;
    }
  int S = R + C + 1, T = R + C + 2;
  int SS = T + 1, TT = T + 2;
  for (int i = 1; i <= R; i++) {
    G.link(S, i, up[i] - down[i]);
    in[i] += down[i];
    out[S] += down[i];
  }
  for (int i = R + 1; i <= R + C; i++) {
    G.link(i, T, up[i] - down[i]);
    out[i] += down[i];
    in[T] += down[i];
  }
  long long maxflow = 0;
  for (int i = 1; i <= T; i++) {
    if (in[i] > out[i])
      G.link(SS, i, in[i] - out[i]), maxflow += in[i] - out[i];
    if (out[i] > in[i]) G.link(i, TT, out[i] - in[i]);
  }
  long long ret1 = 0;
  G.S = SS;
  G.T = TT;
  G.link(T, S, INF);
  ret1 = G.dinic();
  if (ret1 != maxflow) {
    printf("-1\n");
    return 0;
  }
  G.S = S;
  G.T = T;
  long long ret2 = G.dinic();
  printf("%I64d\n", ret2 * min(r, b) + (n - ret2) * max(r, b));
  for (int i = 1; i <= n; i++)
    if (G.c[id[i]] == 0)
      printf(r < b ? "r" : "b");
    else
      printf(r < b ? "b" : "r");
}
