#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, m, Red, Blue;
bool Swaped;
int X[maxn], nX, Y[maxn], nY, x[maxn], y[maxn], degX[maxn], degY[maxn],
    limX[maxn], limY[maxn];
int EID[maxn];
map<pair<int, int>, int> mymap;
pair<int, pair<int, int> > qr[maxn];
struct Edge {
  int u, v, cap, flow;
};
vector<Edge> E;
vector<int> adj[maxn + maxn];
int q[maxn + maxn], pos[maxn + maxn], d[maxn + maxn], mark[maxn + maxn];
int s, t, sumLowCap, cntFLowTime;
void AddEdge(int u, int v, int cap) {
  adj[u].push_back(E.size());
  E.push_back({u, v, cap, 0});
  adj[v].push_back(E.size());
  E.push_back({v, u, 0, 0});
}
void AddFakeEdge(int u, int v, int Lo, int Hi) {
  if (Lo > Hi) {
    cout << -1;
    exit(0);
  }
  AddEdge(s, v, Lo);
  AddEdge(u, t, Lo);
  AddEdge(u, v, Hi - Lo);
  sumLowCap += Lo;
}
void Input() {
  cin >> n >> m;
  cin >> Red >> Blue;
  if (Red < Blue) {
    swap(Red, Blue);
    Swaped = true;
  }
  for (int i = (1); i <= (n); ++i) {
    cin >> x[i] >> y[i];
    X[i] = x[i];
    Y[i] = y[i];
  }
  nX = nY = n;
  sort(X + 1, X + 1 + nX);
  nX = unique(X + 1, X + 1 + nX) - X - 1;
  sort(Y + 1, Y + 1 + nY);
  nY = unique(Y + 1, Y + 1 + nY) - Y - 1;
  int i = 1;
  for (int j = (1); j <= (m); ++j) {
    cin >> qr[i].first >> qr[i].second.first >> qr[i].second.second;
    if (qr[i].first == 1) {
      int pos = lower_bound(X + 1, X + 1 + nX, qr[i].second.first) - X;
      if (X[pos] != qr[i].second.first) continue;
      qr[i].second.first = pos;
      ++i;
    } else {
      int pos = lower_bound(Y + 1, Y + 1 + nY, qr[i].second.first) - Y;
      if (Y[pos] != qr[i].second.first) continue;
      qr[i].second.first = pos;
      ++i;
    }
  }
  m = i - 1;
}
bool FlowBFS() {
  int l = 1, r = 1;
  q[1] = s;
  mark[s] = ++cntFLowTime;
  while (l <= r) {
    int u = q[l++];
    pos[u] = 0;
    for (int id : adj[u]) {
      int v = E[id].v;
      if (E[id].flow == E[id].cap || mark[v] == cntFLowTime) continue;
      q[++r] = v;
      d[v] = d[u] + 1;
      mark[v] = cntFLowTime;
    }
  }
  return mark[t] == cntFLowTime;
}
int FlowDFS(int u, int low) {
  if (u == t || low == 0) return low;
  for (; pos[u] < adj[u].size(); ++pos[u]) {
    int id = adj[u][pos[u]];
    int v = E[id].v;
    if (E[id].flow == E[id].cap || d[v] != d[u] + 1) continue;
    int nxt = FlowDFS(v, min(low, E[id].cap - E[id].flow));
    if (nxt) {
      E[id].flow += nxt;
      E[id ^ 1].flow -= nxt;
      return nxt;
    }
  }
  return 0;
}
int MeoMeo(int x[], int y[], int idX, int idY, int nX, int nY) {
  for (int i = (1); i <= (n); ++i) ++degX[x[i]], ++degY[y[i]];
  for (int i = (1); i <= (nX); ++i) limX[i] = degX[i];
  for (int i = (1); i <= (nY); ++i) limY[i] = degY[i];
  for (int i = (1); i <= (m); ++i) {
    if (qr[i].first == idX)
      limX[qr[i].second.first] =
          min(limX[qr[i].second.first], qr[i].second.second);
    else
      limY[qr[i].second.first] =
          min(limY[qr[i].second.first], qr[i].second.second);
  }
  int SFake = nX + nY + 1, TFake = nX + nY + 2;
  s = TFake + 1;
  t = s + 1;
  for (int i = (1); i <= (nX); ++i)
    AddFakeEdge(SFake, i, (degX[i] - limX[i] + 1) / 2, (degX[i] + limX[i]) / 2);
  for (int i = (1); i <= (nY); ++i)
    AddFakeEdge(i + nX, TFake, (degY[i] - limY[i] + 1) / 2,
                (degY[i] + limY[i]) / 2);
  for (int i = (1); i <= (n); ++i) {
    AddEdge(x[i], y[i] + nX, 1);
    EID[i] = E.size() - 2;
  }
  while (FlowBFS())
    while (int FLOW = FlowDFS(s, 1e9)) sumLowCap -= FLOW;
  AddEdge(TFake, SFake, 1e9);
  while (FlowBFS())
    while (int FLOW = FlowDFS(s, 1e9)) sumLowCap -= FLOW;
  if (sumLowCap != 0) {
    cout << -1;
    exit(0);
  }
  return (*(E.end() - 2)).flow;
}
void Solve() {
  for (int i = (1); i <= (n); ++i)
    x[i] = lower_bound(X + 1, X + 1 + nX, x[i]) - X,
    y[i] = lower_bound(Y + 1, Y + 1 + nY, y[i]) - Y;
  int res = 0;
  res = MeoMeo(x, y, 1, 2, nX, nY);
  cout << 1ll * res * Red + 1ll * (n - res) * Blue << '\n';
  for (int i = (1); i <= (n); ++i)
    cout << (E[EID[i]].flow ^ Swaped ? 'r' : 'b');
}
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  Input();
  Solve();
  return 0;
}
