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 = 2e5 + 10;
const int Inf = 1e9 + 7;
struct Coor {
  int x, y;
} P[MAXN];
map<int, int> HashX, HashY;
int N, M, r, b, CntX, CntY, ConX[MAXN], ConY[MAXN], NumX[MAXN], NumY[MAXN];
int S, T, SS, TT, Count[MAXN * 2], High[MAXN * 2];
int tot, Last[MAXN * 2], Go[MAXN * 10], Next[MAXN * 10], Len[MAXN * 10];
bool Flag[MAXN];
void Link(int u, int v, int len) {
  Next[++tot] = Last[u], Last[u] = tot, Go[tot] = v, Len[tot] = len;
}
void Open(int u, int v, int len) { Link(u, v, len), Link(v, u, 0); }
bool Open(int u, int v, int Min, int Max) {
  if (Min > Max) return 0;
  Open(u, v, Max - Min);
  Open(u, TT, Min), Open(SS, v, Min);
  return 1;
}
int Dfs(int Now, int flow, int From, int to) {
  if (Now == to) return flow;
  int Use = 0;
  for (int p = Last[Now]; p; p = Next[p]) {
    int v = Go[p];
    if (Len[p] > 0 && High[v] + 1 == High[Now]) {
      int t = Dfs(v, min(Len[p], flow - Use), From, to);
      Len[p] -= t, Len[p ^ 1] += t, Use += t;
      if (Use == flow) return flow;
    }
  }
  if (!(--Count[High[Now]])) High[From] = TT + 1;
  Count[++High[Now]]++;
  return Use;
}
int Flow_Go(int From, int to) {
  memset(Count, 0, sizeof Count);
  memset(High, 0, sizeof High);
  Count[0] = to + 1;
  int Ans = 0;
  while (High[From] <= to) Ans += Dfs(From, Inf, From, to);
  return Ans;
}
void ReLink() {
  Last[S] = Next[Last[S]], Last[T] = Next[Last[T]];
  for (int p = Last[SS]; p; p = Next[p]) Len[p] = 0, Len[p ^ 1] = 0;
  for (int p = Last[TT]; p; p = Next[p]) Len[p] = 0, Len[p ^ 1] = 0;
}
void Solve() {
  Open(T, S, Inf);
  Flow_Go(SS, TT);
  for (int p = Last[SS]; p; p = Next[p])
    if (Len[p]) {
      printf("-1\n");
      return;
    }
  int Ans = Len[Last[S]];
  ReLink();
  Ans += Flow_Go(S, T);
  char c1 = 'r', c2 = 'b';
  if (r > b) swap(r, b), swap(c1, c2);
  printf("%I64d\n", 1ll * Ans * r + 1ll * (N - Ans) * b);
  for (int i = 1; i <= N; i++)
    if (Len[i * 2 + 1] == 1)
      printf("%c", c1);
    else
      printf("%c", c2);
}
void Prepare() {
  S = 0, T = CntX + CntY + 1, SS = T + 1, TT = SS + 1;
  for (int i = 1; i <= CntX; i++) ConX[i] = NumX[i];
  for (int i = 1; i <= CntY; i++) ConY[i] = NumY[i];
  for (int i = 1; i <= M; i++) {
    int t, l, d;
    scanf("%d%d%d", &t, &l, &d);
    if (t == 1) {
      int x = HashX[l];
      if (!x) continue;
      ConX[x] = min(ConX[x], d);
    } else {
      int y = HashY[l];
      if (!y) continue;
      ConY[y] = min(ConY[y], d);
    }
  }
  tot = 1;
  for (int i = 1; i <= N; i++) Open(P[i].x, P[i].y + CntX, 1);
  for (int i = 1; i <= CntX; i++) {
    if (!Open(S, i, max(0, (NumX[i] - ConX[i] + 1) / 2),
              min(NumX[i], (NumX[i] + ConX[i]) / 2))) {
      printf("-1\n");
      return;
    }
  }
  for (int i = 1; i <= CntY; i++) {
    if (!Open(i + CntX, T, max(0, (NumY[i] - ConY[i] + 1) / 2),
              min(NumY[i], (NumY[i] + ConY[i]) / 2))) {
      printf("-1\n");
      return;
    }
  }
  Solve();
}
int main() {
  scanf("%d%d", &N, &M);
  scanf("%d%d", &r, &b);
  for (int i = 1; i <= N; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (!HashX[x]) HashX[x] = ++CntX;
    if (!HashY[y]) HashY[y] = ++CntY;
    P[i].x = HashX[x], P[i].y = HashY[y];
    NumX[P[i].x]++, NumY[P[i].y]++;
  }
  Prepare();
}