#include <bits/stdc++.h>
using namespace std;
int n, m, cnt, c[1000005];
pair<int, int> seg[4 * 1000005];
pair<pair<int, int>, int> x[1000005], a[1000005];
pair<pair<int, int>, pair<int, int> > y[1000005], b[1000005];
pair<long long, pair<int, int> > cvp;
vector<int> amk;
map<int, int> yer;
void up(int k, int bas, int son, int x, int y, int z) {
  if (bas > x or son < x) return;
  if (bas == son) {
    seg[k] = max(seg[k], make_pair(y, z));
    return;
  }
  up((k + k), bas, ((bas + son) >> 1), x, y, z);
  up((k + k + 1), ((bas + son) >> 1) + 1, son, x, y, z);
  seg[k] = max(seg[(k + k)], seg[(k + k + 1)]);
}
pair<int, int> qu(int k, int bas, int son, int x, int y) {
  if (bas > y or son < x) return make_pair(0, 0);
  if (bas >= x and son <= y) return seg[k];
  return max(qu((k + k), bas, ((bas + son) >> 1), x, y),
             qu((k + k + 1), ((bas + son) >> 1) + 1, son, x, y));
}
void upp(int k, int bas, int son, int x, int y, int z) {
  if (bas > x or son < x) return;
  if (bas == son) {
    seg[k] = min(seg[k], make_pair(y, z));
    return;
  }
  upp((k + k), bas, ((bas + son) >> 1), x, y, z);
  upp((k + k + 1), ((bas + son) >> 1) + 1, son, x, y, z);
  seg[k] = min(seg[(k + k)], seg[(k + k + 1)]);
}
pair<int, int> quu(int k, int bas, int son, int x, int y) {
  if (bas > y or son < x) return make_pair(1000000007, 1000000007);
  if (bas >= x and son <= y) return seg[k];
  return min(quu((k + k), bas, ((bas + son) >> 1), x, y),
             quu((k + k + 1), ((bas + son) >> 1) + 1, son, x, y));
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &x[i].first.second, &x[i].first.first);
    x[i].second = i;
    amk.push_back(x[i].first.second);
    amk.push_back(x[i].first.first);
    a[i].first.second = x[i].first.first;
    a[i].first.first = x[i].first.second;
    a[i].second = i;
  }
  sort(x + 1, x + n + 1);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &y[i].first.second, &y[i].first.first,
          &y[i].second.second);
    y[i].second.first = i;
    amk.push_back(y[i].first.second);
    amk.push_back(y[i].first.first);
    b[i].first.first = y[i].first.second;
    b[i].first.second = y[i].first.first;
    b[i].second.second = y[i].second.second;
    b[i].second.first = i;
  }
  sort(y + 1, y + m + 1);
  sort(b + 1, b + m + 1);
  sort(amk.begin(), amk.end());
  yer[amk[0]] = cnt = 1;
  for (int i = 1; i < amk.size(); i++)
    yer[amk[i]] = cnt += (amk[i - 1] != amk[i]);
  int son = 1;
  for (int i = 1; i <= m; i++) {
    while (son <= n and x[son].first.first <= y[i].first.first) {
      up(1, 1, cnt, yer[x[son].first.second],
         x[son].first.first - x[son].first.second, x[son].second);
      son++;
    }
    pair<int, int> ne =
        qu(1, 1, cnt, yer[y[i].first.second], yer[y[i].first.first]);
    cvp = max(cvp, make_pair(1ll * y[i].second.second * ne.first,
                             make_pair(ne.second, y[i].second.first)));
  }
  for (int i = 0; i < 4 * 1000005; i++)
    seg[i] = make_pair(1000000007, 1000000007);
  son = n;
  for (int i = m; i >= 1; i--) {
    while (son >= 1 and x[son].first.first >= y[i].first.first) {
      upp(1, 1, cnt, yer[x[son].first.second], x[son].first.second,
          x[son].second);
      son--;
    }
    pair<int, int> ne =
        quu(1, 1, cnt, yer[y[i].first.second], yer[y[i].first.first]);
    if (ne.first < 1000000007)
      cvp = max(cvp, make_pair(1ll * y[i].second.second *
                                   (y[i].first.first - ne.first),
                               make_pair(ne.second, y[i].second.first)));
  }
  memset(seg, 0, sizeof seg);
  son = 1;
  for (int i = 1; i <= m; i++) {
    while (son <= n and a[son].first.first <= b[i].first.first) {
      up(1, 1, cnt, yer[a[son].first.second], a[son].first.second,
         a[son].second);
      son++;
    }
    pair<int, int> ne =
        qu(1, 1, cnt, yer[b[i].first.first], yer[b[i].first.second]);
    cvp = max(
        cvp, make_pair(1ll * b[i].second.second * (ne.first - b[i].first.first),
                       make_pair(ne.second, b[i].second.first)));
    ne = qu(1, 1, cnt, yer[b[i].first.second], cnt);
    if (ne.second)
      cvp = max(cvp, make_pair(1ll * b[i].second.second *
                                   (b[i].first.second - b[i].first.first),
                               make_pair(ne.second, b[i].second.first)));
  }
  printf("%lld\n", cvp.first);
  if (cvp.first) printf("%d %d\n", cvp.second.first, cvp.second.second);
  return 0;
}
