#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
const long double pi = acos(-1.0);
const int INF = (int)2e9;
const int N = (int)4e5 + 10;
long long ans = 0;
int ans_i, ans_j, n, m, l[N], r[N], x[N], y[N], c[N];
void solve() {
  vector<pair<int, pair<int, int> > > e;
  for (int i = 0; i < n; ++i) e.push_back(make_pair(l[i], make_pair(0, i)));
  for (int i = 0; i < m; ++i) e.push_back(make_pair(x[i], make_pair(1, i)));
  sort(e.begin(), e.end());
  int mx_r = -INF, mx_num = -1;
  set<pair<pair<int, int>, int> > cur;
  cur.insert(make_pair(make_pair(INF, 0), -1));
  for (int i = 0; i < ((int)(e).size()); ++i) {
    int etype = e[i].second.first, num = e[i].second.second;
    if (etype == 0) {
      if (mx_r < r[num]) {
        mx_r = r[num];
        mx_num = num;
      }
      assert(!cur.empty());
      set<pair<pair<int, int>, int> >::iterator it =
          cur.lower_bound(make_pair(make_pair(mx_r, -1), -1));
      if ((mx_num != -1) &&
          (ans < it->first.second * (long long)(mx_r - e[i].first))) {
        ans = it->first.second * (long long)(mx_r - e[i].first);
        ans_i = mx_num, ans_j = it->second;
      }
    } else {
      if ((mx_num != -1) &&
          (ans < c[num] * (long long)(min(mx_r, y[num]) - e[i].first))) {
        ans = c[num] * (long long)(min(mx_r, y[num]) - e[i].first);
        ans_i = mx_num, ans_j = num;
      }
      set<pair<pair<int, int>, int> >::iterator it =
          cur.lower_bound(make_pair(make_pair(y[num], -1), -1));
      if (it->first.second >= c[num]) continue;
      while (true) {
        set<pair<pair<int, int>, int> >::iterator it =
            cur.lower_bound(make_pair(make_pair(y[num] + 1, -1), -1));
        if (it == cur.begin()) break;
        --it;
        if (it->first.second > c[num]) break;
        cur.erase(it);
      }
      cur.insert(make_pair(make_pair(y[num], c[num]), num));
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d%d", &l[i], &r[i]);
  for (int i = 0; i < m; ++i) scanf("%d%d%d", &x[i], &y[i], &c[i]);
  for (int j = 0; j < 2; ++j) {
    solve();
    for (int i = 0; i < n; ++i) l[i] *= -1, r[i] *= -1, swap(l[i], r[i]);
    for (int i = 0; i < m; ++i) x[i] *= -1, y[i] *= -1, swap(x[i], y[i]);
  }
  if (ans == 0) {
    printf("0\n");
    return 0;
  }
  printf("%I64d\n%d %d\n", ans, ans_i + 1, ans_j + 1);
  return 0;
}
