#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return a > val ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
const int oo = (int)1e9;
struct Dinic {
  int n, s, t, E, adj[10000010], next[10000010], last[1000010], run[1000010],
      level[1000010], que[1000010];
  int flow[10000010], cap[10000010];
  void init(int _n, int _s, int _t) {
    n = _n;
    s = _s;
    t = _t;
    E = 0;
    fill_n(last, n + 1, -1);
  }
  void add(int u, int v, int c1, int c2) {
    adj[E] = v;
    flow[E] = 0;
    cap[E] = c1;
    next[E] = last[u];
    last[u] = E++;
    adj[E] = u;
    flow[E] = 0;
    cap[E] = c2;
    next[E] = last[v];
    last[v] = E++;
  }
  int bfs() {
    fill_n(level, n + 1, -1);
    level[s] = 0;
    int qsize = 0;
    que[qsize++] = s;
    for (int i = 0; i < qsize; i++) {
      for (int u = que[i], e = last[u]; ~e; e = next[e]) {
        int v = adj[e];
        if (flow[e] < cap[e] && !~level[v]) {
          level[v] = level[u] + 1;
          que[qsize++] = v;
        }
      }
    }
    return level[t] != -1;
  }
  int dfs(int u, int bot) {
    if (u == t) return bot;
    for (int& e = run[u]; ~e; e = next[e]) {
      int v = adj[e];
      int delta = 0;
      if (level[v] == level[u] + 1 && flow[e] < cap[e] &&
          (delta = dfs(v, min(bot, cap[e] - flow[e]))) > 0) {
        flow[e] += delta;
        flow[e ^ 1] -= delta;
        return delta;
      }
    }
    return 0;
  }
  int maxflow() {
    int total = 0;
    while (bfs()) {
      for (int i = 0; i <= n; i++) run[i] = last[i];
      for (int delta = dfs(s, oo); delta > 0; delta = dfs(s, oo))
        total += delta;
    }
    return total;
  }
} dinic;
const int maxn = 100000 + 10;
int n, m;
int r, b;
int x[maxn];
int y[maxn];
int f[maxn];
int g[maxn];
int cnt1, cnt2;
map<int, int> dc1;
map<int, int> dc2;
int ver[maxn];
int hor[maxn];
int vmn[maxn];
int vmx[maxn];
int hmn[maxn];
int hmx[maxn];
map<pair<int, int>, int> hs;
int check(int mi, int fl = 0) {
  int tot = cnt1 + cnt2;
  int s = tot++, t1 = tot++, t2 = tot++, _s = tot++, _t = tot++;
  dinic.init(tot, _s, _t);
  int tot1 = 0, tot2 = 0;
  for (int i = (0); i < (cnt1); i++) {
    dinic.add(_s, i, vmn[i], 0);
    dinic.add(s, i, vmx[i] - vmn[i], 0);
    tot1 += vmn[i];
  }
  for (int i = (0); i < (cnt2); i++) {
    dinic.add(cnt1 + i, _t, hmn[i], 0);
    dinic.add(cnt1 + i, t1, hmx[i] - hmn[i], 0);
    tot2 += hmn[i];
  }
  for (int i = (0); i < (n); i++) {
    dinic.add(x[i], cnt1 + y[i], 1, 0);
  }
  dinic.add(s, _t, tot1, 0);
  dinic.add(_s, t1, tot2, 0);
  dinic.add(_s, t2, mi, 0);
  dinic.add(t1, _t, mi, 0);
  dinic.add(t2, s, INF, 0);
  int t = dinic.maxflow();
  if (fl) {
    for (int i = (0); i < (cnt1); i++) {
      for (int e = dinic.last[i]; e != -1; e = dinic.next[e])
        if (dinic.flow[e] > 0) {
          int j = dinic.adj[e];
          if (j >= cnt1 && j < cnt1 + cnt2) {
            hs[make_pair(i, j - cnt1)]++;
          }
        }
    }
  }
  return t == tot1 + tot2 + mi;
}
void solve() {
  cin >> n >> m >> r >> b;
  for (int i = (0); i < (n); i++) cin >> x[i] >> y[i];
  for (int i = (0); i < (n); i++) dc1[x[i]];
  for (__typeof((dc1).begin()) it = (dc1).begin(); it != (dc1).end(); it++)
    it->second = cnt1++;
  for (int i = (0); i < (n); i++) ver[x[i] = dc1[x[i]]]++;
  for (int i = (0); i < (n); i++) dc2[y[i]];
  for (__typeof((dc2).begin()) it = (dc2).begin(); it != (dc2).end(); it++)
    it->second = cnt2++;
  for (int i = (0); i < (n); i++) hor[y[i] = dc2[y[i]]]++;
  for (int i = (0); i < (cnt1); i++) vmn[i] = 0, vmx[i] = ver[i];
  for (int i = (0); i < (cnt2); i++) hmn[i] = 0, hmx[i] = hor[i];
  for (int i = (0); i < (m); i++) {
    int t, l, d;
    cin >> t >> l >> d;
    if (t == 1) {
      if (dc1.count(l)) {
        l = dc1[l];
        chkmax(vmn[l], (ver[l] - d + 1) / 2);
        chkmin(vmx[l], (ver[l] + d) / 2);
        if (vmn[l] > vmx[l]) {
          cout << -1 << "\n";
          return;
        }
      }
    } else if (t == 2) {
      if (dc2.count(l)) {
        l = dc2[l];
        chkmax(hmn[l], (hor[l] - d + 1) / 2);
        chkmin(hmx[l], (hor[l] + d) / 2);
        if (hmn[l] > hmx[l]) {
          cout << -1 << "\n";
          return;
        }
      }
    }
  }
  int lo = 0, hi = n + 1;
  while (lo < hi) {
    int mi = lo + hi >> 1;
    if (!check(mi))
      lo = mi + 1;
    else
      hi = mi;
  }
  if (lo == n + 1) {
    cout << -1 << "\n";
    return;
  }
  check(lo, 1);
  cout << (long long)max(r, b) * lo + (long long)min(r, b) * (n - lo) << "\n";
  for (int i = (0); i < (n); i++) {
    if (hs[make_pair(x[i], y[i])]) {
      hs[make_pair(x[i], y[i])]--;
      if (r < b)
        cout << "b";
      else
        cout << "r";
    } else {
      if (r < b)
        cout << "r";
      else
        cout << "b";
    }
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
