#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
pair<pair<int, int>, int> a[200200 * 2];
int c[200200];
int arr[200200 * 8];
pair<int, int> mx[200200 * 8];
void update(int u, pair<int, int> val) {
  while (u) {
    smax(mx[u], val);
    u -= u & (-u);
  }
}
pair<int, int> calc(int u) {
  pair<int, int> ans = pair<int, int>(0, 0);
  while (u < 200200 * 8) {
    smax(ans, mx[u]);
    u += u & (-u);
  }
  return ans;
}
bool cmp1(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return a.first.first != b.first.first ? a.first.first < b.first.first
                                        : a.second > b.second;
}
bool cmp2(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return a.first.first != b.first.first ? a.first.first < b.first.first
                                        : a.second < b.second;
}
bool cmp3(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return a.first.second != b.first.second ? a.first.second > b.first.second
                                          : a.second < b.second;
}
int main() {
  int n, m;
  cin >> n >> m;
  int nn = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i].first.first, &a[i].first.second);
    arr[nn++] = a[i].first.first;
    arr[nn++] = a[i].first.second;
    a[i].second = i;
  }
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &a[n + i].first.first, &a[n + i].first.second, c + i);
    arr[nn++] = a[n + i].first.first;
    arr[nn++] = a[n + i].first.second;
    a[n + i].second = n + i;
  }
  sort(arr, arr + nn);
  nn = unique(arr, arr + nn) - arr;
  for (int i = 0; i < n + m; i++) {
    a[i].first.first = upper_bound(arr, arr + nn, a[i].first.first) - arr;
    a[i].first.second = upper_bound(arr, arr + nn, a[i].first.second) - arr;
  }
  long long ans = 0;
  int p, q;
  sort(a, a + n + m, cmp1);
  for (int i = 0; i < n + m; i++) {
    if (a[i].second < n) {
      pair<int, int> t = calc(a[i].first.second);
      if (ans < 1LL * t.first *
                    (arr[a[i].first.second - 1] - arr[a[i].first.first - 1])) {
        ans = 1LL * t.first *
              (arr[a[i].first.second - 1] - arr[a[i].first.first - 1]);
        p = a[i].second;
        q = t.second;
      }
    } else
      update(a[i].first.second,
             pair<int, int>(c[a[i].second - n], a[i].second - n));
  }
  pair<int, int> tp = pair<int, int>(0, 0);
  sort(a, a + n + m, cmp2);
  for (int i = 0; i < n + m; i++) {
    if (a[i].second < n)
      smax(tp, pair<int, int>(a[i].first.second, a[i].second));
    else {
      if (ans < 1LL * c[a[i].second - n] *
                    (arr[min(a[i].first.second, tp.first) - 1] -
                     arr[a[i].first.first - 1])) {
        ans = 1LL * c[a[i].second - n] *
              (arr[min(a[i].first.second, tp.first) - 1] -
               arr[a[i].first.first - 1]);
        p = tp.second;
        q = a[i].second - n;
      }
    }
  }
  tp = pair<int, int>(nn, 0);
  sort(a, a + n + m, cmp3);
  for (int i = 0; i < n + m; i++) {
    if (a[i].second < n)
      smin(tp, pair<int, int>(a[i].first.first, a[i].second));
    else {
      if (ans < 1LL * c[a[i].second - n] *
                    (arr[a[i].first.second - 1] -
                     arr[max(a[i].first.first, tp.first) - 1])) {
        ans = 1LL * c[a[i].second - n] *
              (arr[a[i].first.second - 1] -
               arr[max(a[i].first.first, tp.first) - 1]);
        p = tp.second;
        q = a[i].second - n;
      }
    }
  }
  if (!ans) return puts("0"), 0;
  cout << ans << endl;
  printf("%d %d\n", p + 1, q + 1);
  return 0;
}
