#include <bits/stdc++.h>
using namespace std;
int read() {
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    ;
  int x = ch - '0';
  for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
    x = x * 10 + ch - '0';
  return x;
}
const int N = 4e5 + 5, M = 2e6 + 5, inf = 0x7fffffff;
int t[M], nxt[M], f[M], lst[N], l;
void add(int x, int y, int z) {
  t[++l] = y;
  f[l] = z;
  nxt[l] = lst[x];
  lst[x] = l;
  t[++l] = x;
  f[l] = 0;
  nxt[l] = lst[y];
  lst[y] = l;
}
int n, m, r, b, S, T, ss, tt, x[N], y[N], bx[N], by[N], ox, oy, cnt[N], used[N];
int lim[N];
void link(int x, int y, int d, int u) {
  if (d > u) {
    puts("-1");
    exit(0);
  }
  used[y] += d;
  used[x] -= d;
  if (u - d) add(x, y, u - d);
}
int dis[N], q[N];
bool bfs(int S, int T) {
  for (int i = 0; i <= ox + oy + 3; i++) dis[i] = 0;
  dis[S] = 1;
  int i = 0, j = 1;
  q[1] = S;
  while (i < j) {
    for (int k = lst[q[++i]]; k; k = nxt[k])
      if (f[k] && !dis[t[k]]) {
        dis[t[k]] = dis[q[i]] + 1;
        q[++j] = t[k];
      }
  }
  return dis[T];
}
int dinic(int x, int y, int T) {
  if (x == T) return y;
  int now = 0;
  for (int i = lst[x]; i; i = nxt[i])
    if (f[i] && dis[t[i]] == dis[x] + 1) {
      int k = dinic(t[i], min(y, f[i]), T);
      f[i] -= k;
      f[i ^ 1] += k;
      y -= k;
      now += k;
      if (!y) break;
    }
  if (!now) dis[x] = -1;
  return now;
}
int max_flow(int S, int T) {
  int ans = 0;
  while (bfs(S, T)) ans += dinic(S, inf, T);
  return ans;
}
int main() {
  n = read();
  m = read();
  r = read();
  b = read();
  l = 1;
  for (int i = 1; i <= n; i++) x[i] = read(), y[i] = read();
  for (int i = 1; i <= n; i++) bx[i] = x[i];
  sort(bx + 1, bx + n + 1);
  ox = unique(bx + 1, bx + n + 1) - bx - 1;
  for (int i = 1; i <= n; i++) by[i] = y[i];
  sort(by + 1, by + n + 1);
  oy = unique(by + 1, by + n + 1) - by - 1;
  S = 0;
  T = ox + oy + 1;
  ss = ox + oy + 2;
  tt = ox + oy + 3;
  for (int i = 1; i <= n; i++) {
    int a = lower_bound(bx + 1, bx + ox + 1, x[i]) - bx;
    int b = lower_bound(by + 1, by + oy + 1, y[i]) - by;
    add(a, b + ox, 1);
    cnt[a]++;
    cnt[b + ox]++;
  }
  for (int i = 1; i <= ox + oy; i++) lim[i] = cnt[i];
  for (int i = 1; i <= m; i++) {
    int t = read(), w = read(), d = read();
    if (t == 1) {
      int a = lower_bound(bx + 1, bx + ox + 1, w) - bx;
      if (bx[a] == w) lim[a] = min(lim[a], d);
    } else {
      int b = lower_bound(by + 1, by + oy + 1, w) - by;
      if (by[b] == w) lim[b + ox] = min(lim[b + ox], d);
    }
  }
  int sum = 0;
  for (int i = 1; i <= ox; i++) {
    link(S, i, (cnt[i] - lim[i] + 1) >> 1, (cnt[i] + lim[i]) >> 1);
    sum += (cnt[i] - lim[i] + 1) >> 1;
  }
  for (int i = ox + 1; i <= ox + oy; i++)
    link(i, T, (cnt[i] - lim[i] + 1) >> 1, (cnt[i] + lim[i]) >> 1);
  add(T, S, inf);
  for (int i = S; i <= T; i++)
    if (used[i] > 0)
      add(ss, i, used[i]);
    else
      add(i, tt, -used[i]);
  int flow = max_flow(ss, tt);
  if (flow < sum) {
    puts("-1");
    return 0;
  }
  lst[ss] = lst[tt] = 0;
  flow = max_flow(S, T);
  char big = 'r', small = 'b';
  if (r < b) swap(big, small), swap(r, b);
  printf("%lld\n", (long long)b * flow + (long long)r * (n - flow));
  for (int i = 1; i <= n; i++) putchar(f[i << 1] ? big : small);
  return 0;
}
