#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
const int inf = 0x3f3f3f3f;
const long long ImaxnF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
bool chkmax(long long& a, long long b) { return a < b ? a = b, true : false; }
bool chkmax(int& a, int b) { return a < b ? a = b, true : false; }
int Log[maxn];
struct ST {
  pair<int, int> dp[maxn][20];
  void build(int n, pair<int, int> b[]) {
    for (int i = 1; i <= n; i++) dp[i][0] = b[i];
    for (int j = 1; j <= Log[n]; j++)
      for (int i = 1; i + (1 << j) - 1 <= n; i++)
        dp[i][j] = max(dp[i][j - 1], dp[i + (1 << (j - 1))][j - 1]);
  }
  pair<int, int> query(int x, int y) {
    int k = Log[y - x + 1];
    return max(dp[x][k], dp[y - (1 << k) + 1][k]);
  }
};
int n, m;
pair<int, int> len[maxn];
pair<int, int> gg = make_pair(1, 1);
pair<pair<int, int>, int> a[maxn];
pair<pair<int, int>, int> b[maxn];
ST rmq;
bool cmp(const pair<pair<int, int>, int>& a,
         const pair<pair<int, int>, int>& b) {
  if (a.first.first == b.first.first) return a.first.second > b.first.second;
  return a.first.first < b.first.first;
}
int main() {
  for (int i = -(Log[0] = -1); i < maxn; i++)
    Log[i] = Log[i - 1] + ((i & (i - 1)) == 0);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &a[i].first.first, &a[i].first.second), a[i].second = i;
  for (int i = 1; i <= m; i++)
    scanf("%d%d%d", &b[i].first.first, &b[i].first.second, &b[i].second);
  sort(a + 1, a + 1 + n, cmp);
  int up = n;
  n = 1;
  for (int i = 1; i <= up; i++)
    if (a[i].first.second > a[n].first.second) a[++n] = a[i];
  for (int i = 1; i <= n; i++)
    len[i].first = a[i].first.second - a[i].first.first,
    len[i].second = a[i].second;
  rmq.build(n, len);
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int L = b[i].first.first, R = b[i].first.second, c = b[i].second, len = 0,
        who = 1;
    int low = 1, high = n, p = -1;
    while (low <= high) {
      int mid = low + high >> 1;
      if (a[mid].first.first <= L)
        p = mid, low = mid + 1;
      else
        high = mid - 1;
    }
    if (~p && a[p].first.second > L &&
        chkmax(len, min(R, a[p].first.second) - L))
      who = a[p].second;
    low = 1, high = n, p = -1;
    while (low <= high) {
      int mid = low + high >> 1;
      if (a[mid].first.second >= R)
        p = mid, high = mid - 1;
      else
        low = mid + 1;
    }
    if (~p && a[p].first.first < R && chkmax(len, R - max(L, a[p].first.first)))
      who = a[p].second;
    int Lb = -1, Rb = -1;
    low = 1, high = n;
    while (low <= high) {
      int mid = low + high >> 1;
      if (a[mid].first.first >= L)
        Lb = mid, high = mid - 1;
      else
        low = mid + 1;
    }
    low = 1, high = n;
    while (low <= high) {
      int mid = low + high >> 1;
      if (a[mid].first.second <= R)
        Rb = mid, low = mid + 1;
      else
        high = mid - 1;
    }
    if (~Lb && ~Rb && Lb <= Rb) {
      pair<int, int> t = rmq.query(Lb, Rb);
      if (chkmax(len, t.first)) who = t.second;
    }
    if (chkmax(ans, 1ll * c * len)) {
      gg.first = who;
      gg.second = i;
    }
  }
  if (ans) {
    printf("%lld\n", ans);
    printf("%d %d\n", gg.first, gg.second);
  } else {
    puts("0");
  }
  return 0;
}
