#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void init(T& x) {
  x = 0;
  char ch = getchar();
  bool t = 0;
  for (; ch > '9' || ch < '0'; ch = getchar())
    if (ch == '-') t = 1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + (ch - 48);
  if (t) x = -x;
  return;
}
const int N = 2e5 + 100;
const int M = 6e5;
const int INF = 1e9;
struct edge {
  int to, next, cap;
} a[M << 1];
int head[N], cnt = 0;
int s, t;
int S, T;
inline void add(int x, int y, int z) {
  a[cnt] = (edge){y, head[x], z};
  head[x] = cnt++;
}
inline void add_edge(int x, int y, int z) { add(x, y, z), add(y, x, 0); }
int n, m;
map<int, int> idH;
int cntH = 0;
map<int, int> idR;
int cntR = 0;
int Numx[N], Numy[N];
int X[N], Y[N];
int r, b;
int Lx[N], Rx[N];
int Ly[N], Ry[N];
int F[N], Std[N], d[N], cur[N];
queue<int> Q;
int dfs(int u, int flow) {
  if (u == T) return flow;
  int res = flow;
  for (int v, &i = cur[u]; ~i; i = a[i].next) {
    v = a[i].to;
    if (d[v] != d[u] + 1 || !a[i].cap) continue;
    int f = dfs(v, min(a[i].cap, res));
    res -= f;
    if (!f) d[v] = 0;
    a[i].cap -= f, a[i ^ 1].cap += f;
    if (!res) break;
  }
  return flow - res;
}
bool bfs() {
  for (int i = 1; i <= T; ++i) d[i] = 0;
  while (!Q.empty()) Q.pop();
  Q.push(S);
  d[S] = 1;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (int v, i = head[u]; ~i; i = a[i].next) {
      v = a[i].to;
      if (!a[i].cap || d[v]) continue;
      d[v] = d[u] + 1;
      if (v == T) return 1;
      Q.push(v);
    }
  }
  return d[T];
}
int Dinic() {
  if (S != 0) d[0] = d[T + 1] = INF;
  int ans = 0;
  memcpy(cur, head, sizeof(cur));
  while (bfs()) {
    for (int i = 0; i <= T; ++i) cur[i] = head[i];
    ans += dfs(S, INF);
  }
  return ans;
}
int main() {
  memset(head, -1, sizeof(head));
  init(n), init(m);
  char cr = 'r', cb = 'b';
  init(r), init(b);
  if (r < b) swap(r, b), swap(cr, cb);
  for (int i = 1; i <= n; ++i) {
    int x, y;
    init(x), init(y);
    int idx, idy;
    if (!idH.count(x))
      idH[x] = idx = ++cntH;
    else
      idx = idH[x];
    if (!idR.count(y))
      idR[y] = idy = ++cntR;
    else
      idy = idR[y];
    ++Numx[idx], ++Numy[idy];
    X[i] = idx, Y[i] = idy;
  }
  s = cntH + cntR + 1, t = s + 1;
  S = 0, T = t + 1;
  for (int i = 1; i <= n; ++i) Std[i] = cnt, add_edge(X[i], Y[i] + cntH, 1);
  for (int i = 1; i <= cntH; ++i) Lx[i] = 0, Rx[i] = n;
  for (int i = 1; i <= cntR; ++i) Ly[i] = 0, Ry[i] = n;
  for (int i = 1; i <= m; ++i) {
    int t, l, d;
    init(t), init(l), init(d);
    if (t == 1) {
      if (!idH.count(l)) {
        --i, --m;
        continue;
      }
      int id = idH[l], num = Numx[id];
      if (num <= d) {
        --i, --m;
        continue;
      }
      Lx[id] = max(Lx[id], (num - d + 1) >> 1);
      Rx[id] = min(Rx[id], (num + d) >> 1);
    } else {
      if (!idR.count(l)) {
        --i, --m;
        continue;
      }
      int id = idR[l], num = Numy[id];
      if (num <= d) {
        --i, --m;
        continue;
      }
      Ly[id] = max(Ly[id], (num - d + 1) >> 1);
      Ry[id] = min(Ry[id], (num + d) >> 1);
      id += cntH;
    }
  }
  add_edge(t, s, INF);
  int sumx = 0, sumy = 0;
  for (int i = 1; i <= cntH; ++i) {
    if (Lx[i] > Rx[i]) return puts("-1"), 0;
    add_edge(s, i, Rx[i] - Lx[i]);
    sumx += Lx[i];
    add_edge(S, i, Lx[i]);
  }
  add_edge(s, T, sumx);
  for (int i = 1; i <= cntR; ++i) {
    if (Ly[i] > Ry[i]) return puts("-1"), 0;
    add_edge(i + cntH, t, Ry[i] - Ly[i]);
    add_edge(i + cntH, T, Ly[i]);
    sumy += Ly[i];
  }
  add_edge(S, t, sumy);
  int fl = 0;
  if ((fl = Dinic()) == sumx + sumy) {
    S = s, T = t;
    Dinic();
    long long cost = 0;
    for (int i = 1; i <= n; ++i)
      if (!a[Std[i]].cap)
        cost += b;
      else
        cost += r;
    cout << cost << endl;
    for (int i = 1; i <= n; ++i)
      if (!a[Std[i]].cap)
        putchar(cb);
      else
        putchar(cr);
    puts("");
  } else
    puts("-1");
  return 0;
}
