#include <bits/stdc++.h>
using namespace std;
const int md = 1000000007;
const int maxn = 201010;
const int maxn4 = 4 * maxn;
const long long inf = 2020202020202020202LL;
vector<pair<int, int>> t[4 * maxn];
vector<int> maxpot[4 * maxn];
pair<int, int> a[maxn], ar[maxn], xx[maxn];
int maxri[maxn], minle[maxn];
int n, m;
void build(pair<int, int> a[], int v, int tl, int tr) {
  if (tl == tr)
    t[v] = vector<pair<int, int>>(
        1, make_pair(a[tl].second, a[tl].second - a[tl].first));
  else {
    int tm = (tl + tr) / 2;
    build(a, v * 2, tl, tm);
    build(a, v * 2 + 1, tm + 1, tr);
    merge(t[v * 2].begin(), t[v * 2].end(), t[v * 2 + 1].begin(),
          t[v * 2 + 1].end(), back_inserter(t[v]));
  }
  maxpot[v].resize(t[v].size());
  maxpot[v][0] = t[v][0].second;
  for (int i = 1; i < t[v].size(); i++)
    maxpot[v][i] = max(maxpot[v][i - 1], t[v][i].second);
}
long long query(int v, int tl, int tr, int l, int r, int y) {
  if (l > r) return 0;
  if (l == tl && tr == r) {
    vector<pair<int, int>>::iterator pos =
        lower_bound((t[v]).begin(), (t[v]).end(), make_pair(y, md));
    if (pos == t[v].begin()) return 0;
    int ps = pos - t[v].begin();
    ps--;
    return maxpot[v][ps];
  }
  int tm = (tl + tr) / 2;
  return max(query(v * 2, tl, tm, l, min(r, tm), y),
             query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, y));
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    a[i] = make_pair(u, v);
    xx[i].first = a[i].first;
    xx[i].second = a[i].second;
    ar[i].first = a[i].second;
    ar[i].second = a[i].first;
  }
  sort(a, a + n);
  sort(ar, ar + n);
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      maxri[i] = a[i].second;
      continue;
    }
    maxri[i] = max(maxri[i - 1], a[i].second);
  }
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      minle[i] = ar[i].second;
      continue;
    }
    minle[i] = min(minle[i + 1], ar[i].second);
  }
  build(a, 1, 0, n - 1);
  long long ans = 0;
  int ansi, ansj, ansx, ansy, ansc;
  for (int i = 0; i < m; i++) {
    int x, y, c;
    scanf("%d %d %d", &x, &y, &c);
    long long res = 0;
    int lb = lower_bound(a, a + n, make_pair(x, md)) - a;
    if (lb != 0) {
      lb--;
      int ri = maxri[lb];
      ri = min(ri, y);
      res = ri - x;
      res = (long long)res * c;
      lb++;
    }
    if (ans < res) {
      ansj = i + 1;
      ansx = x;
      ansy = y;
      ansc = c;
    }
    ans = max(ans, res);
    res = 0;
    int rb = lower_bound(ar, ar + n, make_pair(y, -1)) - ar;
    if (rb != n) {
      int le = minle[rb];
      le = max(le, x);
      res = y - le;
      res = (long long)res * c;
    }
    if (ans < res) {
      ansj = i + 1;
      ansx = x;
      ansy = y;
      ansc = c;
    }
    ans = max(res, ans);
    res = 0;
    res = query(1, 0, n - 1, lb, n - 1, y);
    res = (long long)res * c;
    if (ans < res) {
      ansj = i + 1;
      ansx = x;
      ansy = y;
      ansc = c;
    }
    ans = max(res, ans);
  }
  cout << ans << endl;
  if (ans) {
    for (int i = 0; i < n; i++) {
      long long d, res = 0;
      int a = xx[i].first;
      int b = xx[i].second;
      int x = ansx;
      int y = ansy;
      if (a > x) {
        swap(a, x);
        swap(b, y);
      }
      int v = min(b, y);
      v = v - x;
      res = v;
      res = (long long)res * ansc;
      if (res == ans) {
        ansi = i + 1;
        break;
      }
    }
    cout << ansi << " " << ansj;
  }
  return 0;
}
