#include <bits/stdc++.h>
using namespace std;
const int Maxx = 200010, INF = 0x3f3f3f3f;
inline int read() {
  int res = 0, bj = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') bj |= (ch == '-'), ch = getchar();
  while (ch >= '0' && ch <= '9')
    res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
  return bj ? -res : res;
}
int n, m, R, B, X[Maxx], Y[Maxx], fx[Maxx], fy[Maxx];
int rx[Maxx], ry[Maxx], ux[Maxx], uy[Maxx], dx[Maxx], dy[Maxx];
int cnt = 1, E, cur[Maxx << 1], rh[Maxx << 1], h[Maxx << 1], to[Maxx * 10],
    nx[Maxx * 10], vl[Maxx * 10];
inline void ckmin(int &x, const int y) { x = x < y ? x : y; }
inline void ckmax(int &x, const int y) { x = x > y ? x : y; }
inline void Add(int x, int y, int v) {
  nx[++cnt] = h[x], to[h[x] = cnt] = y, vl[cnt] = v;
  nx[++cnt] = h[y], to[h[y] = cnt] = x, vl[cnt] = 0;
}
int d[Maxx], Q[Maxx];
inline bool Bfs(int x) {
  memset(d, -1, sizeof(int) * (E + 1));
  int l = 0, r = 0;
  d[Q[++r] = x] = 0;
  while (l < r) {
    for (int i = h[x = Q[++l]], y; i; i = nx[i])
      if (vl[i] && d[y = to[i]] == -1) {
        d[y] = d[x] + 1;
        if ((Q[++r] = y) == E) return 1;
      }
  }
  return 0;
}
int Dfs(int x, int Mx) {
  if (x == E) return Mx;
  int ret = 0, dlt;
  for (int i = h[x]; Mx && i; i = nx[i])
    if (vl[i] && d[to[i]] == d[x] + 1) {
      if ((dlt = Dfs(to[i], vl[i] < Mx ? vl[i] : Mx)))
        vl[i] -= dlt, vl[i ^ 1] += dlt, Mx -= dlt, ret += dlt;
      else
        d[to[i]] = 0;
    }
  return ret;
}
int P[Maxx];
signed main() {
  n = read(), m = read();
  int R = read(), B = read(), mx, my;
  char bj = 0;
  for (int i = 1; i <= n; ++i) X[i] = read(), Y[i] = read();
  if (R > B) bj = 1, swap(R, B), swap(X, Y);
  for (int i = 1; i <= n; ++i) fx[i] = X[i], fy[i] = Y[i];
  sort(fx + 1, fx + n + 1), mx = unique(fx + 1, fx + n + 1) - fx - 1;
  sort(fy + 1, fy + n + 1), my = unique(fy + 1, fy + n + 1) - fy - 1;
  for (int i = 1; i <= n; ++i)
    X[i] = lower_bound(fx + 1, fx + mx + 1, X[i]) - fx;
  for (int i = 1; i <= n; ++i)
    Y[i] = lower_bound(fy + 1, fy + my + 1, Y[i]) - fy;
  for (int i = 1; i <= n; ++i) ++rx[X[i]], ++ry[Y[i]];
  for (int i = 1; i <= mx; ++i) ux[i] = rx[i];
  for (int i = 1; i <= my; ++i) uy[i] = ry[i];
  for (int i = 1; i <= m; ++i) {
    int o = (read() - 1) ^ bj, l = read(), d = read();
    if (!o) {
      int x = lower_bound(fx + 1, fx + mx + 1, l) - fx;
      if (fx[x] != l) continue;
      ckmax(dx[x], (rx[x] - d + 1) >> 1), ckmin(ux[x], (rx[x] + d) >> 1);
    } else {
      int y = lower_bound(fy + 1, fy + my + 1, l) - fy;
      if (fy[y] != l) continue;
      ckmax(dy[y], (ry[y] - d + 1) >> 1), ckmin(uy[y], (ry[y] + d) >> 1);
    }
  }
  int S = mx + my + 1, T = S + 1;
  for (int i = 1; i <= mx; ++i) {
    if (ux[i] < dx[i])
      return puts("-1"), 0;
    else
      Add(S, i, ux[i] - dx[i]);
  }
  for (int i = 1; i <= n; ++i) Add(X[i], mx + Y[i], 1), P[i] = cnt;
  for (int i = 1; i <= my; ++i) {
    if (uy[i] < dy[i])
      return puts("-1"), 0;
    else
      Add(i + mx, T, uy[i] - dy[i]);
  }
  memcpy(rh, h, sizeof(int) * (T + 1));
  int RS = T + 1, RT = RS + 1, SR = 0, TR = 0;
  for (int i = 1; i <= mx; ++i) Add(RS, i, dx[i]), SR += dx[i];
  for (int i = 1; i <= my; ++i) Add(i + mx, RT, dy[i]), TR += dy[i];
  Add(S, RT, SR), Add(RS, T, TR), Add(T, S, INF);
  int res = 0;
  E = RT, memcpy(cur, h, sizeof(int) * (E + 1));
  while (Bfs(RS)) res += Dfs(RS, 1 << 30);
  if (res < SR + TR) return puts("-1"), 0;
  memcpy(h, rh, sizeof(int) * (T + 1));
  E = T, memcpy(cur, h, sizeof(int) * (E + 1));
  while (Bfs(S)) res += Dfs(S, 1 << 30);
  long long Ans = 0;
  for (int i = 1; i <= n; ++i) P[i] = vl[P[i]], Ans += P[i] ? R : B;
  cout << Ans << "\n";
  for (int i = 1; i <= n; ++i) putchar(P[i] ^ bj ? 'r' : 'b');
  return 0;
}
