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 long long inf = 1e9;
struct MaxFlow {
  struct edge {
    long long to, f, id;
  };
  long long n, tar;
  vector<long long> d, cur, w;
  vector<vector<edge>> e;
  void ext(long long x) {
    if (++x > n) e.resize(n = x), w.resize(n);
  }
  inline void add(long long x, long long y, long long z, long long l) {
    if (l > z) puts("-1"), exit(0);
    ext(x), ext(y), w[y] += l, w[x] -= l;
    e[x].push_back((edge){y, z - l, (long long)e[y].size()});
    e[y].push_back((edge){x, 0, (long long)e[x].size() - 1});
  }
  bool bfs(long long s) {
    long long r = 1;
    vector<long long> q(n);
    fill(d.begin(), d.end(), 0), d[s] = 1, q[1] = s;
    for (long long l = 1; l <= r; ++l)
      for (edge &i : e[q[l]])
        if (i.f && !d[i.to]) d[i.to] = d[q[l]] + 1, q[++r] = i.to;
    return d[tar];
  }
  long long dfs(long long u, long long flow = inf) {
    if (u == tar || !flow) return flow;
    long long now = 0;
    for (long long &i = cur[u]; i < (long long)e[u].size(); ++i) {
      edge &p = e[u][i];
      if (p.f && d[p.to] == d[u] + 1) {
        long long t = dfs(p.to, min(flow - now, (long long)p.f));
        p.f -= t, e[p.to][p.id].f += t, now += t;
        if (now == flow) return now;
      }
    }
    return now;
  }
  long long solve(long long s, long long t) {
    long long ans = 0, ss = n, tt = n + 1;
    ext(tt);
    d.resize(n), cur.resize(n);
    add(t, s, inf, 0);
    for (long long i = 1; i < ss; ++i)
      if (w[i] < 0)
        add(i, tt, -w[i], 0);
      else if (w[i] > 0)
        add(ss, i, w[i], 0);
    tar = tt;
    while (bfs(ss)) fill(cur.begin(), cur.end(), 0), dfs(ss);
    for (edge &i : e[ss])
      if (i.f) return -1;
    tar = t;
    while (bfs(s)) fill(cur.begin(), cur.end(), 0), dfs(s);
    for (edge &i : e[s])
      if (i.to != t && i.to != ss && i.to != tt) ans += e[i.to][i.id].f;
    return ans - w[s];
  }
} wish;
bool o;
long long n, m, c1, c2;
map<long long, long long> sa, sb;
map<long long, multiset<long long>> a, b;
signed main() {
  scanf("%lld%lld%lld%lld", &n, &m, &c1, &c2);
  if (c1 > c2) swap(c1, c2), o = 1;
  for (long long i = 1, x, y; i <= n; ++i)
    scanf("%lld%lld", &x, &y), a[x].insert(i), b[y].insert(i);
  for (long long i = 1, x, y, z; i <= m; ++i) {
    scanf("%lld%lld%lld", &x, &y, &z);
    if (x == 1)
      if (!sa.count(y))
        sa[y] = z;
      else
        sa[y] = min(sa[y], z);
    else if (!sb.count(y))
      sb[y] = z;
    else
      sb[y] = min(sb[y], z);
  }
  long long p = n, S = ++p, T = ++p;
  for (auto &i : a) {
    ++p;
    if (!sa.count(i.first))
      wish.add(S, p, n, 0);
    else {
      long long s = i.second.size(), x = sa[i.first];
      wish.add(S, p, (s + x) / 2, max(0ll, (s - x + 1) / 2));
    }
    for (long long j : i.second) wish.add(p, j, 1, 0);
  }
  for (auto &i : b) {
    ++p;
    if (!sb.count(i.first))
      wish.add(p, T, n, 0);
    else {
      long long s = i.second.size(), x = sb[i.first];
      wish.add(p, T, (s + x) / 2, max(0ll, (s - x + 1) / 2));
    }
    for (long long j : i.second) wish.add(j, p, 1, 0);
  }
  long long ans = wish.solve(S, T);
  if (ans == -1) return puts("-1"), 0;
  printf("%lld\n", (long long)c1 * ans + (long long)c2 * (n - ans));
  for (long long i = 1; i <= n; ++i)
    putchar(wish.e[i][wish.e[i][0].to > wish.e[i][1].to].f ^ o ? 'r' : 'b');
  return 0;
}