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;
struct Info {
  int nu, ne, qu;
} a[100010 * 10];
int m, n, num = 0, d[100010][2], c[100010][2], s, t, ns, nt, b[100010 * 2],
          di[100010 * 2], cur[100010 * 2], li[100010 * 2], ans, a2, a1, ch = 0;
long long R, B;
struct Onfo {
  int x, y, z;
} p[100010], q[100010];
map<int, int> o;
void jb(int x, int y, int z) {
  a[++num].nu = y;
  a[num].ne = b[x];
  b[x] = num;
  a[num].qu = z;
  a[++num].nu = x;
  a[num].ne = b[y];
  b[y] = num;
  a[num].qu = 0;
}
void jb(int x, int y, int p, int q) {
  if (q - p) jb(x, y, q - p);
  if (p) {
    a1 += p;
    jb(x, nt, p);
    jb(ns, y, p);
  }
}
bool bfs(int s, int t) {
  for (int i = 1; i <= nt; i++) di[i] = 1e9;
  int l = 1, r = 1;
  li[l] = s;
  di[s] = 0;
  while (l <= r) {
    for (int y = b[li[l]]; y; y = a[y].ne)
      if (di[a[y].nu] == 1e9 && a[y].qu) {
        di[a[y].nu] = di[li[l]] + 1;
        li[++r] = a[y].nu;
      }
    l++;
  }
  return (di[t] != 1e9);
}
int dinic(int x, int mu, int sh) {
  if (x == mu) {
    if (mu == t)
      ans += sh;
    else
      a2 += sh;
    return sh;
  }
  int s1 = 0, s2;
  for (int y = cur[x]; y; y = a[y].ne) {
    cur[x] = y;
    if (di[a[y].nu] == di[x] + 1 && a[y].qu) {
      s2 = dinic(a[y].nu, mu, min(a[y].qu, sh - s1));
      s1 += s2;
      a[y].qu -= s2;
      a[y ^ 1].qu += s2;
      if (s1 == sh) return s1;
    }
  }
  return s1;
}
void get(int s, int t) {
  while (bfs(s, t)) {
    for (int i = 1; i <= nt; i++) cur[i] = b[i];
    dinic(s, t, 1e9);
  }
}
int main() {
  cin >> n >> m;
  cin >> R >> B;
  for (int i = 1; i <= n; i++) cin >> p[i].x >> p[i].y;
  for (int i = 1; i <= m; i++) cin >> q[i].x >> q[i].y >> q[i].z;
  if (R > B) {
    swap(R, B);
    ch = 1;
    for (int i = 1; i <= n; i++) swap(p[i].x, p[i].y);
    for (int i = 1; i <= m; i++) q[i].x = 3 - q[i].x;
  }
  o.clear();
  num = 0;
  for (int i = 1; i <= n; i++) {
    if (o[p[i].x] == 0) o[p[i].x] = ++num;
    p[i].x = o[p[i].x];
  }
  for (int i = 1; i <= m; i++)
    if (q[i].x == 1) q[i].y = o[q[i].y];
  o.clear();
  num = 0;
  for (int i = 1; i <= n; i++) {
    if (o[p[i].y] == 0) o[p[i].y] = ++num;
    p[i].y = o[p[i].y];
  }
  for (int i = 1; i <= m; i++)
    if (q[i].x == 2) q[i].y = o[q[i].y];
  for (int i = 1; i <= n; i++) {
    d[p[i].x][0]++;
    d[p[i].y][1]++;
  }
  for (int i = 1; i <= n; i++) c[i][0] = d[i][0], c[i][1] = d[i][1];
  for (int i = 1; i <= m; i++)
    d[q[i].y][q[i].x - 1] = min(d[q[i].y][q[i].x - 1], q[i].z);
  s = n + n + 1, t = n + n + 2;
  ns = n + n + 3, nt = n + n + 4;
  num = 1;
  for (int i = 1; i <= n; i++) jb(p[i].x, p[i].y + n, 0, 1);
  for (int i = 1; i <= n; i++) {
    int ma, mi;
    if (c[i][0]) {
      ma = (c[i][0] + d[i][0]) / 2, mi = c[i][0] - ma;
      jb(s, i, mi, ma);
    }
    if (mi > ma) {
      puts("-1");
      return 0;
    }
    if (c[i][1]) {
      ma = (c[i][1] + d[i][1]) / 2, mi = c[i][1] - ma;
      jb(i + n, t, mi, ma);
    }
    if (mi > ma) {
      puts("-1");
      return 0;
    }
  }
  jb(t, s, 1e9);
  get(ns, nt);
  ans = a[num].qu;
  a[num].qu = a[num - 1].qu = 0;
  if (a1 != a2) {
    puts("-1");
    return 0;
  }
  get(s, t);
  cout << ans * R + (n - ans) * B << endl;
  for (int i = 1; i <= n; i++)
    if (a[i * 2].qu ^ ch)
      putchar('b');
    else
      putchar('r');
  return 0;
}