#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
struct edge {
  long long to, next, w;
} e[N * 10];
long long head[N], ecnt = 1, extra[N];
inline void adde(long long from, long long to, long long w) {
  e[++ecnt] = (edge){to, head[from], w}, head[from] = ecnt;
  e[++ecnt] = (edge){from, head[to], 0}, head[to] = ecnt;
}
inline void adde(long long from, long long to, long long down, long long up) {
  long long delta = up - down;
  adde(from, to, delta);
  extra[to] += down, extra[from] -= down;
}
long long dep[N], cur[N];
inline bool BFS(long long s, long long t) {
  memset(dep, 0, sizeof(dep)), dep[s] = 1;
  queue<long long> q;
  q.push(s);
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    for (long long i = head[u]; i; i = e[i].next)
      if (e[i].w && !dep[e[i].to]) {
        assert(e[i].w > 0);
        dep[e[i].to] = dep[u] + 1, q.push(e[i].to);
        if (e[i].to == t) return true;
      }
  }
  return false;
}
long long DFS(long long u, long long f, long long t) {
  if (u == t || !f) return f;
  long long res = 0;
  for (long long &i = cur[u], tmp; i; i = e[i].next)
    if (e[i].w && dep[e[i].to] == dep[u] + 1 &&
        (tmp = DFS(e[i].to, min(f, e[i].w), t))) {
      e[i].w -= tmp, e[i ^ 1].w += tmp, f -= tmp, res += tmp;
      if (!f) break;
    }
  return res;
}
inline long long dinic(long long s, long long t) {
  long long res = 0;
  while (BFS(s, t)) memcpy(cur, head, sizeof(head)), res += DFS(s, 1e18, t);
  return res;
}
inline long long FUCKYPJ(long long S, long long T, long long n) {
  long long s = T + 1, t = s + 1, tot = 0;
  for (long long i = 1; i <= n; i++)
    if (extra[i] > 0)
      adde(s, i, extra[i]), tot += extra[i];
    else
      adde(i, t, -extra[i]);
  adde(T, S, 0, 1e9);
  if (dinic(s, t) != tot) return -1;
  long long res = 0;
  for (long long i = head[S]; i; i = e[i].next)
    if (e[i].to == T) res = e[i].w, e[i].w = 0;
  return res + dinic(S, T);
}
long long x[N], y[N], id[N];
map<long long, long long> X, Y, X1, Y1, X2, Y2;
signed main() {
  long long n, m, r, b, flag = 0;
  scanf("%lld%lld%lld%lld", &n, &m, &r, &b);
  if (r > b) swap(r, b), flag = 1;
  for (long long i = 1; i <= n; i++)
    scanf("%lld%lld", &x[i], &y[i]), X[x[i]]++, Y[y[i]]++;
  long long A = X.size(), B = Y.size(), s = A + B + 1, t = s + 1;
  for (long long i = 1; i <= m; i++) {
    long long t, l, d;
    scanf("%lld%lld%lld", &t, &l, &d);
    if (t == 1) {
      if (!X1.count(l))
        X1[l] = d;
      else
        X1[l] = min(X1[l], d);
    } else {
      if (!Y1.count(l))
        Y1[l] = d;
      else
        Y1[l] = min(Y1[l], d);
    }
  }
  long long ct = 0;
  for (auto t : X) {
    long long t1 = t.first, all = t.second;
    X2[t1] = ++ct;
    long long lim = X1.count(t1) ? X1[t1] : 1e9;
    long long L = (all - lim + 1) / 2, R = min(n, (all + lim) / 2);
    if (L > R) return puts("-1"), 0;
    adde(s, ct, L, R);
  }
  for (auto T : Y) {
    long long t1 = T.first, all = T.second;
    Y2[t1] = ++ct;
    long long lim = Y1.count(t1) ? Y1[t1] : 1e9;
    long long L = max(0ll, (all - lim + 1) / 2), R = min(n, (all + lim) / 2);
    if (L > R) return puts("-1"), 0;
    adde(ct, t, L, R);
  }
  for (long long i = 1; i <= n; i++)
    adde(X2[x[i]], Y2[y[i]], 0, 1), id[i] = ecnt - 1;
  long long res = FUCKYPJ(s, t, t);
  if (res == -1)
    puts("-1");
  else {
    printf("%lld\n", (long long)res * r + (long long)(n - res) * b);
    for (long long i = 1; i <= n; i++) {
      long long t = e[id[i]].w ^ flag;
      if (!t)
        putchar('r');
      else
        putchar('b');
    }
  }
}
