#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T a, T b) {
  ;
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
namespace std {
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& a) {
  out << '(' << a.first << ',' << a.second << ')';
  return out;
}
}  // namespace std
long long int readL() {
  long long int res;
  scanf("%I64d", &res);
  return res;
}
void printL(long long int res) { printf("%I64d", res); }
const int INF = 1.05e9;
int n, m;
pair<pair<int, int>, int> range[200005];
pair<pair<int, int>, pair<int, int> > ad[200005];
pair<int, int> Rmax[200005];
pair<long long int, pair<int, int> > ans;
void solve1() {
  sort(range, range + n);
  Rmax[0] = make_pair(-INF, -1);
  for (int i = 0; i < (n); ++i) {
    Rmax[i + 1] =
        max(Rmax[i], make_pair(range[i].first.second, range[i].second));
  }
  for (int i = 0; i < (m); ++i) {
    int a = ad[i].first.first, b = ad[i].first.second, c = ad[i].second.first,
        id = ad[i].second.second;
    int p =
        lower_bound(range, range + n, make_pair(make_pair(a + 1, -INF), 0)) -
        range;
    chmax(ans, make_pair((min(b, Rmax[p].first) - a) * (long long int)c,
                         make_pair(Rmax[p].second, id)));
  }
}
pair<pair<int, int>, pair<int, int> > event[400005];
bool cmp(const pair<pair<int, int>, pair<int, int> >& a,
         const pair<pair<int, int>, pair<int, int> >& b) {
  return make_pair(a.first.second, a.second.first) <
         make_pair(b.first.second, b.second.first);
}
struct handler {
  struct node {
    pair<int, int> val;
    node(pair<int, int> val = make_pair(0, 0)) : val(val) {}
  };
  handler() {}
  static node def_node() { return node(make_pair(-INF, -INF)); }
  static node merge(const node& a, const node& b) {
    return node(max(a.val, b.val));
  }
};
template <class Handler>
struct segtree {
  static const int MAX_N = 1100000;
  typename Handler::node val[MAX_N];
  int n;
  Handler hdl;
  void init(int n_, typename Handler::node* a = NULL) {
    n = 1;
    while (n < n_) n <<= 1;
    for (int i = 0; i < (n * 2); ++i) val[i] = hdl.def_node();
    if (a != NULL) {
      for (int i = 0; i < (n_); ++i) val[i + n - 1] = a[i];
      for (int i = n - 2; i >= 0; --i)
        val[i] = Handler::merge(val[i * 2 + 1], val[i * 2 + 2]);
    }
  }
  void set(int k, typename Handler::node a) {
    k += n - 1;
    val[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      val[k] = hdl.merge(val[k * 2 + 1], val[k * 2 + 2]);
    }
  }
  typename Handler::node query(int a, int b, int i, int l, int r) {
    if (a <= l && r <= b) return val[i];
    if (b <= l || r <= a) return hdl.def_node();
    int md = (l + r) >> 1;
    return hdl.merge(query(a, b, i * 2 + 1, l, md),
                     query(a, b, i * 2 + 2, md, r));
  }
  typename Handler::node query(int a, int b) { return query(a, b, 0, 0, n); }
};
segtree<handler> seg;
int xzip[400005];
void solve2() {
  for (int i = 0; i < (n); ++i)
    event[i] = make_pair(range[i].first, make_pair(-1, range[i].second));
  for (int i = 0; i < (m); ++i) event[i + n] = ad[i];
  int cnt = n + m;
  sort(event, event + cnt, cmp);
  for (int i = 0; i < (cnt); ++i) xzip[i] = event[i].first.first;
  sort(xzip, xzip + cnt);
  int zn = unique(xzip, xzip + cnt) - xzip;
  seg.init(zn);
  for (int i = 0; i < (cnt); ++i) {
    pair<pair<int, int>, pair<int, int> >& e = event[i];
    int p = lower_bound(xzip, xzip + zn, e.first.first) - xzip;
    if (e.second.first == -1) {
      seg.set(p, make_pair(e.first.second - e.first.first, e.second.second));
    } else {
      int p2 = lower_bound(xzip, xzip + zn, e.first.second) - xzip;
      pair<int, int> tmp = seg.query(p, p2).val;
      long long int val = tmp.first;
      val *= e.second.first;
      chmax(ans, make_pair(val, make_pair(tmp.second, e.second.second)));
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < (n); ++i) {
    scanf("%d%d", &range[i].first.first, &range[i].first.second);
    range[i].second = i;
  }
  for (int i = 0; i < (m); ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    ad[i] = make_pair(make_pair(a, b), make_pair(c, i));
  }
  solve2();
  ;
  ;
  solve1();
  for (int i = 0; i < (n); ++i) {
    swap(range[i].first.first, range[i].first.second);
    range[i].first.first *= -1;
    range[i].first.second *= -1;
  }
  for (int i = 0; i < (m); ++i) {
    swap(ad[i].first.first, ad[i].first.second);
    ad[i].first.first *= -1;
    ad[i].first.second *= -1;
  };
  ;
  solve1();
  cout << ans.first << endl;
  if (ans.first == 0) return 0;
  cout << ans.second.first + 1 << ' ' << ans.second.second + 1 << endl;
  return 0;
}
