#include <bits/stdc++.h>
using namespace std;
int maxi, mx;
int n, q;
struct seg {
  int l, r, id;
  bool operator<(const seg& k) const {
    if (l == k.l)
      return r > k.r;
    else
      return l < k.l;
  }
} s[200005];
int seg[550005], seg2[550005];
void init(int L, int R, int id) {
  if (L == R) {
    seg[id] = s[L].r - s[L].l;
    seg2[id] = s[L].id;
    return;
  }
  int m = (L + R) >> 1;
  init(L, m, id * 2);
  init(m + 1, R, id * 2 + 1);
  if (seg[id * 2] > seg[id * 2 + 1]) {
    seg[id] = seg[id * 2];
    seg2[id] = seg2[id * 2];
  } else {
    seg[id] = seg[id * 2 + 1];
    seg2[id] = seg2[id * 2 + 1];
  }
  return;
}
void query(int L, int R, int id, int sl, int sr) {
  if (sl <= L && R <= sr) {
    if (seg[id] > maxi) {
      maxi = seg[id], mx = seg2[id];
    }
    return;
  }
  if (sl > R || L > sr) return;
  int m = (L + R) >> 1;
  query(L, m, id * 2, sl, sr);
  query(m + 1, R, id * 2 + 1, sl, sr);
  return;
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &s[i].l, &s[i].r);
    s[i].id = i;
  }
  sort(s + 1, s + n + 1);
  int rn = -1, p = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i].r > rn) {
      rn = s[i].r, s[++p] = s[i];
    }
  }
  n = p;
  init(1, n, 1);
  long long opt = 0;
  int oi, oj;
  for (int i = 1; i <= q; i++) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if (s[1].l >= b || a >= s[n].r) continue;
    int Ll, Lr, Rl, Rr;
    int l = 0, r = n + 1;
    while (r - l > 1) {
      int m = (l + r) >> 1;
      if (s[m].l >= b)
        r = m;
      else
        l = m;
    }
    Lr = l;
    l = 0, r = n + 1;
    while (r - l > 1) {
      int m = (l + r) >> 1;
      if (s[m].l > a)
        r = m;
      else
        l = m;
    }
    Ll = l;
    l = 0, r = n + 1;
    while (r - l > 1) {
      int m = (l + r) >> 1;
      if (s[m].r <= a)
        l = m;
      else
        r = m;
    }
    Rl = r;
    l = 0, r = n + 1;
    while (r - l > 1) {
      int m = (l + r) >> 1;
      if (s[m].r < b)
        l = m;
      else
        r = m;
    }
    Rr = r;
    if (Ll >= Rr) {
      if (1LL * (b - a) * c > opt) {
        opt = 1LL * (b - a) * c, oi = s[Ll].id, oj = i;
      }
    } else {
      if (Ll >= Rl) {
        if (1LL * (s[Ll].r - a) * c > opt) {
          opt = 1LL * (s[Ll].r - a) * c, oi = s[Ll].id, oj = i;
        }
      }
      if (Lr >= Rr) {
        if (1LL * (b - s[Rr].l) * c > opt) {
          opt = 1LL * (b - s[Rr].l) * c, oi = s[Rr].id, oj = i;
        }
      }
    }
    int tl = Ll, tr = Rr;
    if (tl <= 0 || s[tl].l < a) tl++;
    if (tr > n || s[tr].r > b) tr--;
    if (tl > tr) continue;
    maxi = 0;
    query(1, n, 1, tl, tr);
    if (1LL * maxi * c > opt) {
      opt = 1LL * maxi * c, oi = mx, oj = i;
    }
  }
  printf("%I64d\n", opt);
  if (opt) printf("%d %d\n", oi, oj);
}
