#include <bits/stdc++.h>
using namespace std;
const int MAXBUF = 1 << 21;
char B[MAXBUF], *Si = B, *Ti = B;
inline char getc() {
  if (Si == Ti) Ti = (Si = B) + fread(B, 1, MAXBUF, stdin);
  if (Si == Ti) return 0;
  return *Si++;
}
template <class T>
inline void read(T &a) {
  static char c;
  while ((c = getc()) < '0' || c > '9')
    ;
  a = c - '0';
  while ((c = getc()) >= '0' && c <= '9') a = (a << 3) + (a << 1) + c - '0';
}
char Buff[MAXBUF], *sti = Buff;
template <class T>
inline void write(T &a) {
  if (a == 0) {
    *sti++ = '0';
    return;
  }
  int t[11], cnt = 0;
  while (a) t[++cnt] = a % 10, a /= 10;
  for (int i = cnt; i >= 1; i--) *sti++ = t[i] + '0';
}
int head[200005], nxt[1000055], v[1000055], w[1000055], tot = 1;
int lev[200005], que[200005], l = 1, r = 0, red, blue;
int x[100005], y[100005], tag[100005], pos[100005], d[100005], n, m;
int tx[100005], ty[100005], lx[100005], ly[100005];
int px[100005], py[100005], cx = 0, cy = 0, st, ed, s, t, ss, tt;
int cur[200005], u[200005], id[100005];
inline int getx(int p) {
  int l = 1, r = cx;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (px[mid] < p) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  if (px[l] == p) return l;
  return -1;
}
inline int gety(int p) {
  int l = 1, r = cy;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (py[mid] < p) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  if (py[l] == p) return l;
  return -1;
}
inline void add(int a, int b, int val) {
  tot++;
  nxt[tot] = head[a];
  head[a] = tot;
  v[tot] = b;
  w[tot] = val;
}
inline void adli(int a, int b, int lo, int hi) {
  if (lo > hi) {
    puts("-1");
    exit(0);
  }
  u[b] += lo;
  u[a] -= lo;
  if (lo ^ hi) {
    add(a, b, hi - lo);
    add(b, a, 0);
  }
}
inline bool bfs() {
  memset(lev, 0x7f, sizeof(lev));
  memcpy(cur, head, sizeof(head));
  l = 1;
  r = 0;
  que[++r] = st;
  lev[st] = 0;
  while (l <= r) {
    int t = que[l++], i;
    for (i = head[t]; i; i = nxt[i]) {
      if (w[i] && lev[v[i]] > lev[t] + 1) {
        lev[v[i]] = lev[t] + 1;
        que[++r] = v[i];
      }
    }
  }
  return lev[ed] < 1000000000;
}
int dfs(int p, int t) {
  if (p == ed) return t;
  int cst = 0;
  for (int &i = cur[p]; i; i = nxt[i]) {
    if (lev[v[i]] != lev[p] + 1 || (!w[i])) continue;
    int o = dfs(v[i], min(t - cst, w[i]));
    cst += o;
    w[i] -= o;
    w[i ^ 1] += o;
    if (cst == t) return t;
  }
  lev[p] = -1;
  return cst;
}
inline int dinic() {
  int flo = 0;
  while (bfs()) flo += dfs(st, 1000000000);
  return flo;
}
int main() {
  int i, rec, res = 0, gg, num = 0, tg = 0;
  read(n);
  read(m);
  read(red);
  read(blue);
  if (red > blue) {
    swap(red, blue);
    tg = 1;
  }
  for (i = 1; i <= n; i++) {
    read(x[i]);
    read(y[i]);
    px[++cx] = x[i];
    py[++cy] = y[i];
  }
  sort(px + 1, px + cx + 1);
  sort(py + 1, py + cy + 1);
  cx = unique(px + 1, px + cx + 1) - px - 1;
  cy = unique(py + 1, py + cy + 1) - py - 1;
  s = cx + cy + 1;
  t = cx + cy + 2;
  ss = cx + cy + 3;
  tt = cx + cy + 4;
  for (i = 1; i <= n; i++) {
    x[i] = getx(x[i]);
    y[i] = gety(y[i]);
    tx[x[i]]++;
    ty[y[i]]++;
  }
  for (i = 1; i <= cx; i++) lx[i] = tx[i];
  for (i = 1; i <= cy; i++) ly[i] = ty[i];
  for (i = 1; i <= m; i++) {
    read(tag[i]);
    read(pos[i]);
    read(d[i]);
    if (tag[i] == 1) pos[i] = getx(pos[i]);
    if (tag[i] == 2) pos[i] = gety(pos[i]);
    if (pos[i] == -1) continue;
    if (tag[i] == 1) lx[pos[i]] = min(lx[pos[i]], d[i]);
    if (tag[i] == 2) ly[pos[i]] = min(ly[pos[i]], d[i]);
  }
  for (i = 1; i <= n; i++) {
    adli(x[i], y[i] + cx, 0, 1);
    id[i] = tot;
  }
  for (i = 1; i <= cx; i++)
    adli(s, i, (tx[i] - lx[i] + 1) >> 1, (tx[i] + lx[i]) >> 1);
  for (i = 1; i <= cy; i++)
    adli(i + cx, t, (ty[i] - ly[i] + 1) >> 1, (ty[i] + ly[i]) >> 1);
  rec = tot;
  add(t, s, 1000000000);
  add(s, t, 0);
  for (i = 1; i <= t; i++) {
    if (u[i] == 0) continue;
    if (u[i] > 0) {
      add(ss, i, u[i]);
      add(i, ss, 0);
      res += u[i];
    } else {
      add(i, tt, -u[i]);
      add(tt, i, 0);
    }
  }
  st = ss;
  ed = tt;
  gg = dinic();
  if (gg != res) {
    puts("-1");
    return 0;
  }
  num = w[rec + 2];
  for (i = rec + 1; i <= tot; i++) w[i] = 0;
  st = s;
  ed = t;
  num += dinic();
  printf("%lld\n", 1ll * num * red + 1ll * (n - num) * blue);
  for (i = 1; i <= n; i++) {
    if (w[id[i]]) {
      putchar(tg ? 'b' : 'r');
    } else {
      putchar(tg ? 'r' : 'b');
    }
  }
  return 0;
}
