#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
class edge {
 public:
  int e, nxt, cap;
  edge() {}
  edge(int e1, int nxt1, int cap1) { e = e1, nxt = nxt1, cap = cap1; }
};
class graph {
 public:
  int S, T;
  void set(int s, int t) {
    S = s;
    T = t;
  }
  edge g[2000010];
  int ecnt, head[N << 1], dep[N << 1], cur[N << 1];
  void init() {
    memset(head, 255, sizeof(head));
    ecnt = 0;
  }
  int addedge(int s, int e, int cap) {
    g[ecnt] = edge(e, head[s], cap), head[s] = ecnt++;
    g[ecnt] = edge(s, head[e], 0), head[e] = ecnt++;
    return ecnt - 2;
  }
  bool bfs() {
    memset(dep, 255, sizeof(dep));
    queue<int> q;
    q.push(S);
    dep[S] = 0;
    while (!q.empty()) {
      int fr = q.front();
      q.pop();
      for (int i = head[fr]; i != -1; i = g[i].nxt) {
        if (g[i].cap && dep[g[i].e] == -1) {
          dep[g[i].e] = dep[fr] + 1;
          q.push(g[i].e);
        }
      }
    }
    return dep[T] != -1;
  }
  int dfs(int np, int inflow) {
    if (np == T || !inflow) return inflow;
    int f, delta = 0;
    for (int i = cur[np]; i != -1; i = g[i].nxt) {
      cur[np] = i;
      if (dep[g[i].e] == dep[np] + 1 &&
          (f = dfs(g[i].e, min(inflow, g[i].cap))) > 0) {
        delta += f;
        inflow -= f;
        g[i].cap -= f;
        g[i ^ 1].cap += f;
        if (!inflow) break;
      }
    }
    return delta;
  }
  int dinic() {
    int ret = 0;
    while (bfs()) {
      memcpy(cur, head, sizeof(cur));
      ret += dfs(S, 0x3f3f3f3f);
    }
    return ret;
  }
};
int n, m, x[N], y[N], lsx[N], lsy[N], cx[N], cy[N], mnx[N], mny[N], r, b, p[N];
class limited_flow {
 public:
  graph G;
  int S, T, SS, TT, d[N << 1], bflow, pbet;
  void set(int s, int t, int ss, int tt) {
    S = s;
    T = t;
    SS = ss;
    TT = tt;
  }
  void init() {
    G.init();
    memset(d, 0, sizeof(d));
    bflow = 0;
  }
  int addedge(int s, int e, int l, int r) {
    if (l > r) {
      puts("-1");
      exit(0);
    }
    d[s] += l;
    d[e] -= l;
    return G.addedge(s, e, r - l);
  }
  void build() {
    for (int i = 1; i <= 2 * n; i++) {
      if (d[i] < 0) G.addedge(SS, i, -d[i]);
      if (d[i] > 0) G.addedge(i, TT, d[i]), bflow += d[i];
    }
    pbet = G.addedge(T, S, 0x3f3f3f3f);
  }
  int maxflow() {
    G.set(SS, TT);
    if (G.dinic() != bflow) return -1;
    int ret = G.g[pbet ^ 1].cap;
    for (int i = G.head[SS]; i != -1; i = G.g[i].nxt)
      G.g[i].cap = G.g[i ^ 1].cap = 0;
    for (int i = G.head[TT]; i != -1; i = G.g[i].nxt)
      G.g[i].cap = G.g[i ^ 1].cap = 0;
    G.g[pbet].cap = G.g[pbet ^ 1].cap = 0;
    G.set(S, T);
    ret += G.dinic();
    return ret;
  }
} G;
bool swp;
int main() {
  G.init();
  scanf("%d%d%d%d", &n, &m, &r, &b);
  if (r > b) swap(r, b), swp = 1;
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &x[i], &y[i]), lsx[i] = x[i], lsy[i] = y[i];
  sort(lsx + 1, lsx + n + 1);
  sort(lsy + 1, lsy + n + 1);
  int cntx = unique(lsx + 1, lsx + n + 1) - lsx - 1,
      cnty = unique(lsy + 1, lsy + n + 1) - lsy - 1;
  for (int i = 1; i <= n; i++) {
    x[i] = lower_bound(lsx + 1, lsx + cntx + 1, x[i]) - lsx;
    y[i] = lower_bound(lsy + 1, lsy + cnty + 1, y[i]) - lsy;
    cx[x[i]]++;
    cy[y[i]]++;
  }
  for (int i = 1; i <= cntx; i++) mnx[i] = cx[i];
  for (int i = 1; i <= cnty; i++) mny[i] = cy[i];
  for (int i = 1, a, b, c; i <= m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    if (a == 1) {
      int p = lower_bound(lsx + 1, lsx + cntx + 1, b) - lsx;
      if (lsx[p] == b) mnx[p] = min(mnx[p], c);
    } else {
      int p = lower_bound(lsy + 1, lsy + cnty + 1, b) - lsy;
      if (lsy[p] == b) mny[p] = min(mny[p], c);
    }
  }
  G.set(cntx + cnty + 1, cntx + cnty + 2, cntx + cnty + 3, cntx + cnty + 4);
  for (int i = 1; i <= n; i++) p[i] = G.addedge(x[i], y[i] + cntx, 0, 1);
  for (int i = 1; i <= cntx; i++) {
    if ((mnx[i] ^ cx[i]) & 1) mnx[i]--;
    if (mnx[i] < 0) {
      puts("-1");
      return 0;
    }
    G.addedge(G.S, i, (cx[i] - mnx[i]) / 2, (cx[i] + mnx[i]) / 2);
  }
  for (int i = 1; i <= cnty; i++) {
    if ((mny[i] ^ cy[i]) & 1) mny[i]--;
    if (mny[i] < 0) {
      puts("-1");
      return 0;
    }
    G.addedge(i + cntx, G.T, (cy[i] - mny[i]) / 2, (cy[i] + mny[i]) / 2);
  }
  G.build();
  int vl = G.maxflow();
  if (vl == -1)
    puts("-1");
  else {
    printf("%lld\n", 1ll * b * n + 1ll * (r - b) * vl);
    for (int i = 1; i <= n; i++)
      putchar((G.G.g[p[i] ^ 1].cap != 0) ^ swp ? 'r' : 'b');
  }
  return 0;
}
