Problem: Steve Rogers is fascinated with new vibranium shields S.H.I.E.L.D gave him. They're all uncolored. There are n shields in total, the i-th shield is located at point (xi, yi) of the coordinate plane. It's possible that two or more shields share the same location.

Steve wants to paint all these shields. He paints each shield in either red or blue. Painting a shield in red costs r dollars while painting it in blue costs b dollars.

Additionally, there are m constraints Steve wants to be satisfied. The i-th constraint is provided by three integers ti, li and di:

  * If ti = 1, then the absolute difference between the number of red and blue shields on line x = li should not exceed di. 
  * If ti = 2, then the absolute difference between the number of red and blue shields on line y = li should not exceed di. 



Steve gave you the task of finding the painting that satisfies all the condition and the total cost is minimum.

Input

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 100 000) — the number of shields and the number of constraints respectively.

The second line contains two integers r and b (1 ≤ r, b ≤ 109).

The next n lines contain the shields coordinates. The i-th of these lines contains two integers xi and yi (1 ≤ xi, yi ≤ 109).

The next m lines contain the constrains. The j-th of these lines contains three integers tj, lj and dj (1 ≤ tj ≤ 2, 1 ≤ lj ≤ 109, 0 ≤ dj ≤ n).

Output

If satisfying all the constraints is impossible print -1 in first and only line of the output.

Otherwise, print the minimum total cost in the first line of output. In the second line print a string of length n consisting of letters 'r' and 'b' only. The i-th character should be 'r' if the i-th shield should be painted red in the optimal answer and 'b' if it should be painted blue. The cost of painting shields in these colors should be equal the minimum cost you printed on the first line.

If there exist more than one optimal solution, print any of them.

Examples

Input

5 6
8 3
2 10
1 5
9 10
9 10
2 8
1 9 1
1 2 1
2 10 3
2 10 2
1 1 1
2 5 2


Output

25
rbrbb


Input

4 4
7 3
10 3
9 8
10 3
2 8
2 8 0
2 8 0
1 2 0
1 9 0


Output

-1

Solution (in CPP):

Solution:
#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;
}