#include <bits/stdc++.h>
using namespace std;
const int N = 100000, INF = (1 << 30) - 1;
int n, m, v[2], x[N + 9], y[N + 9], ord[N + 9], co;
int opt[N + 9], l[N + 9], d[N + 9];
void into() {
  scanf("%d%d%d%d", &n, &m, &v[0], &v[1]);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &x[i], &y[i]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &opt[i], &l[i], &d[i]);
    assert(d[i] >= 0 && d[i] <= n);
  }
}
int dx[N + 9], dy[N + 9], cx[N + 9], cy[N + 9];
void Get_xy() {
  for (int i = 1; i <= m; ++i) dx[i] = dy[i] = n;
  for (int i = 1; i <= n; ++i) ord[++co] = x[i];
  sort(ord + 1, ord + co + 1);
  co = unique(ord + 1, ord + co + 1) - ord - 1;
  for (int i = 1; i <= n; ++i)
    ++cx[x[i] = lower_bound(ord + 1, ord + co + 1, x[i]) - ord];
  for (int i = 1; i <= m; ++i) {
    if (opt[i] == 2) continue;
    int p = lower_bound(ord + 1, ord + co + 1, l[i]) - ord;
    if (l[i] == ord[p]) dx[p] = min(dx[p], d[i]);
  }
  co = 0;
  for (int i = 1; i <= n; ++i) ord[++co] = y[i];
  sort(ord + 1, ord + co + 1);
  co = unique(ord + 1, ord + co + 1) - ord - 1;
  for (int i = 1; i <= n; ++i)
    ++cy[y[i] = lower_bound(ord + 1, ord + co + 1, y[i]) - ord];
  for (int i = 1; i <= m; ++i) {
    if (opt[i] == 1) continue;
    int p = lower_bound(ord + 1, ord + co + 1, l[i]) - ord;
    if (l[i] == ord[p]) dy[p] = min(dy[p], d[i]);
  }
}
int st, td, st0, td0, cn;
int sum, df[N * 2 + 9];
long long ans;
struct side {
  int y, next, f;
} e[N * 20 + 9];
int lin[N * 2 + 9], cs;
void Ins(int x, int y, int f) {
  e[++cs].y = y;
  e[cs].f = f;
  e[cs].next = lin[x];
  lin[x] = cs;
}
void Ins_flow(int x, int y, int f) {
  Ins(x, y, f);
  Ins(y, x, 0);
}
void Get_graph() {
  cs = 1;
  st0 = n * 2 + 1;
  td0 = n * 2 + 2;
  st = n * 2 + 3;
  td = cn = n * 2 + 4;
  for (int i = 1; i <= n; ++i) Ins_flow(x[i], y[i] + n, 1);
  for (int i = 1; i <= n; ++i) {
    int l = max(cx[i] - dx[i] + 1 >> 1, 0), r = cx[i] - l;
    if (l > r) {
      ans = -1;
      return;
    }
    Ins_flow(st0, i, r - l);
    df[st0] -= l;
    df[i] += l;
    l = max(cy[i] - dy[i] + 1 >> 1, 0);
    r = cy[i] - l;
    if (l > r) {
      ans = -1;
      return;
    }
    Ins_flow(i + n, td0, r - l);
    df[i + n] -= l;
    df[td0] += l;
  }
  for (int i = 1; i <= cn - 2; ++i) {
    if (!df[i]) continue;
    df[i] > 0 ? Ins_flow(st, i, df[i]) : Ins_flow(i, td, -df[i]);
    sum += max(df[i], 0);
  }
  Ins_flow(td0, st0, INF);
}
int dis[N * 2 + 9];
queue<int> q;
bool Bfs_dis(int st, int td) {
  for (int i = 1; i <= cn; ++i) dis[i] = 0;
  dis[st] = 1;
  q.push(st);
  for (; !q.empty();) {
    int t = q.front();
    q.pop();
    for (int i = lin[t]; i; i = e[i].next)
      if (e[i].f && !dis[e[i].y]) dis[e[i].y] = dis[t] + 1, q.push(e[i].y);
  }
  return dis[td];
}
int cur[N * 2 + 9];
int Dfs_flow(int k, int td, int f) {
  if (k == td || !f) return f;
  int res = 0;
  for (int &i = cur[k]; i; i = e[i].next)
    if (e[i].f && dis[k] + 1 == dis[e[i].y]) {
      int t = Dfs_flow(e[i].y, td, min(f, e[i].f));
      if (!t) dis[e[i].y] = 0;
      f -= t;
      res += t;
      e[i].f -= t;
      e[i ^ 1].f += t;
      if (!f) return res;
    }
  return res;
}
int Max_flow(int st, int td) {
  int res = 0;
  for (; Bfs_dis(st, td); res += Dfs_flow(st, td, INF))
    for (int i = 1; i <= cn; ++i) cur[i] = lin[i];
  return res;
}
int flag;
void Get_ans() {
  if (ans == -1) return;
  if (v[0] < v[1]) swap(v[0], v[1]), flag = 1;
  int t = Max_flow(st, td);
  ans = t == sum ? Max_flow(st0, td0) : -1;
}
void work() {
  Get_xy();
  Get_graph();
  Get_ans();
}
void outo() {
  if (ans == -1)
    puts("-1");
  else {
    printf("%lld\n", (n - ans) * v[0] + ans * v[1]);
    for (int i = 2; i <= n << 1; i += 2) putchar(e[i].f ^ flag ? 'r' : 'b');
  }
}
int main() {
  into();
  work();
  outo();
  return 0;
}
