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
#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
void read(Tp &x) {
  x = 0;
  long long fh = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') {
      fh = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= fh;
}
namespace Network_Flow {
struct Edge {
  long long f, t, w, nxt;
  Edge(long long ff, long long tt, long long ww, long long nnxt)
      : f(ff), t(tt), w(ww), nxt(nnxt) {}
  Edge() {}
} edge[2000005];
long long head[500005], etot = 1;
void add_edge(long long f, long long t, long long w) {
  Edge tmpe(f, t, w, head[f]);
  edge[++etot] = tmpe;
  head[f] = etot;
}
void add_nete(long long f, long long t, long long w) {
  add_edge(f, t, w);
  add_edge(t, f, 0);
}
long long dep[500005], chd[500005];
queue<long long> q;
void reset() {
  Edge rese(0, 0, 0, 0);
  for (long long i = 1; (i << 1) <= etot; ++i) {
    head[edge[i << 1].f] = head[edge[i << 1].t] = 0;
  }
  for (long long i = 2; i <= etot; ++i) edge[i] = rese;
  etot = 1;
}
bool bfs(long long S, long long T) {
  memset(dep, -1, sizeof(dep));
  dep[S] = 1;
  q.push(S);
  while (!q.empty()) {
    long long x = q.front();
    q.pop();
    for (long long i = head[x]; i; i = edge[i].nxt) {
      long long y = edge[i].t, w = edge[i].w;
      if (~dep[y] || !w) continue;
      dep[y] = dep[x] + 1;
      q.push(y);
    }
  }
  return dep[T] != -1;
}
long long dfs(long long x, long long f, long long T) {
  if (x == T) return f;
  long long g = 0;
  for (long long &i = chd[x]; i; i = edge[i].nxt) {
    long long y = edge[i].t;
    if (!edge[i].w || dep[y] != dep[x] + 1) continue;
    long long dd = dfs(y, min(f - g, edge[i].w), T);
    edge[i].w -= dd;
    edge[i ^ 1].w += dd;
    g += dd;
    if (f == g) return g;
  }
  return g;
}
long long Dinic(long long S, long long T) {
  long long ans = 0;
  while (bfs(S, T)) {
    memcpy(chd, head, sizeof(head));
    ans += dfs(S, 0x3f3f3f3f3f3f3f3fll, T);
  }
  return ans;
}
}  // namespace Network_Flow
namespace Lim_Network_Flow {
using Network_Flow::add_nete;
using Network_Flow::Dinic;
using Network_Flow::reset;
struct Edge {
  long long f, t, wl, wr;
  Edge(long long ff, long long tt, long long wwl, long long wwr)
      : f(ff), t(tt), wl(wwl), wr(wwr) {}
  Edge() {}
} edge[2000005];
long long etot;
void add_edge(long long f, long long t, long long wl, long long wr) {
  Edge tmpe(f, t, wl, wr);
  edge[++etot] = tmpe;
}
long long ifl[500005], ofl[500005];
void clear() {
  Edge rese(0, 0, 0, 0);
  for (long long i = 1; i <= etot; ++i) {
    ifl[edge[i].f] = ofl[edge[i].f] = 0;
    ifl[edge[i].t] = ofl[edge[i].t] = 0;
  }
  for (long long i = 1; i <= etot; ++i) edge[i] = rese;
  etot = 0;
}
long long NSTF(long long flg = 0) {
  if (!flg) reset();
  long long ret = 0, mx = 0;
  for (long long i = 1; i <= etot; ++i) {
    long long u = edge[i].f, v = edge[i].t, wl = edge[i].wl, wr = edge[i].wr;
    mx = max(mx, max(u, v));
    ret += wl;
    ifl[v] += wl;
    ofl[u] += wl;
    add_nete(u, v, wr - wl);
  }
  long long S = mx + 1, T = S + 1, sm = 0;
  for (long long i = 1; i <= mx; ++i) {
    if (ifl[i] > ofl[i])
      add_nete(S, i, ifl[i] - ofl[i]), sm += ifl[i] - ofl[i];
    else
      add_nete(i, T, ofl[i] - ifl[i]);
  }
  if (Dinic(S, T) != sm) return -1;
  return 0;
}
long long STAF(long long S, long long T) {
  reset();
  add_nete(T, S, 0x3f3f3f3f3f3f3f3fll);
  if (NSTF(1) == -1) return -1;
  return Network_Flow::edge[3].w;
}
long long STMXF(long long S, long long T) {
  long long ret = STAF(S, T);
  if (ret == -1) return -1;
  Network_Flow::edge[2].w = Network_Flow::edge[3].w = 0;
  ret += Dinic(S, T);
  return ret;
}
long long STMNF(long long S, long long T) {
  long long ret = STAF(S, T);
  if (ret == -1) return -1;
  Network_Flow::edge[2].w = Network_Flow::edge[3].w = 0;
  ret -= Dinic(T, S);
  return ret;
}
}  // namespace Lim_Network_Flow
long long ans;
long long typ[500005];
long long n, m, R, B;
void get_ans() {
  for (long long i = 1; i <= n; ++i) {
    long long id = (2 * i + 3);
    typ[i] = Network_Flow::edge[id].w;
    if (typ[i])
      ans += B;
    else
      ans += R;
  }
}
map<long long, vector<long long> > mpx, mpy;
long long tax[500005], tatx;
long long tay[500005], taty;
struct node {
  long long x, y;
} a[500005];
long long lmx[500005], lmy[500005];
long long FLAG;
signed main() {
  long long flg = 0;
  read(n);
  read(m);
  read(R);
  read(B);
  if (R > B) flg = 1, swap(R, B);
  for (long long i = 1, x, y; i <= n; ++i) {
    read(x);
    read(y);
    a[i] = (node){x, y};
    mpx[x].push_back(i);
    mpy[y].push_back(i);
    tax[++tatx] = x;
    tay[++taty] = y;
  }
  sort(tax + 1, tax + tatx + 1);
  tatx = unique(tax + 1, tax + tatx + 1) - tax - 1;
  sort(tay + 1, tay + taty + 1);
  taty = unique(tay + 1, tay + taty + 1) - tay - 1;
  long long S = tatx + taty + 1, T = S + 1;
  for (long long i = 1, x, y; i <= n; ++i) {
    x = a[i].x;
    y = a[i].y;
    x = lower_bound(tax + 1, tax + tatx + 1, x) - tax;
    y = lower_bound(tay + 1, tay + taty + 1, y) - tay;
    Lim_Network_Flow::add_edge(x, y + tatx, 0, 1);
  }
  for (long long i = 1; i <= tatx || i <= taty; ++i)
    lmx[i] = lmy[i] = 0x3f3f3f3f3f3f3f3fll;
  for (long long i = 1, t, p, d; i <= m; ++i) {
    read(t);
    read(p);
    read(d);
    if (t == 1) {
      if (!mpx.count(p)) continue;
      p = lower_bound(tax + 1, tax + tatx + 1, p) - tax;
      lmx[p] = min(lmx[p], d);
    } else {
      if (!mpy.count(p)) continue;
      p = lower_bound(tay + 1, tay + taty + 1, p) - tay;
      lmy[p] = min(lmy[p], d);
    }
  }
  for (long long i = 1; i <= tatx; ++i) {
    long long nm = mpx[tax[i]].size(), d = lmx[i];
    long long l = max(0ll, nm - d), r = nm + d;
    l = ((l + 1) >> 1);
    r >>= 1;
    r = min(r, nm);
    if (l > r) {
      puts("-1");
      return 0;
    }
    Lim_Network_Flow::add_edge(S, i, l, r);
  }
  for (long long i = 1; i <= taty; ++i) {
    long long nm = mpy[tay[i]].size(), d = lmy[i];
    long long l = max(0ll, nm - d), r = nm + d;
    l = ((l + 1) >> 1);
    r >>= 1;
    r = min(r, nm);
    if (l > r) {
      puts("-1");
      return 0;
    }
    Lim_Network_Flow::add_edge(i + tatx, T, l, r);
  }
  long long tmp = Lim_Network_Flow::STMNF(S, T);
  if (tmp == -1) {
    puts("-1");
    return 0;
  }
  get_ans();
  printf("%lld\n", ans);
  for (long long i = 1; i <= n; ++i) putchar((typ[i] ^ flg) ? 'b' : 'r');
  puts("");
  return 0;
}
