#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T>
inline T abs(T x) {
  return x > T() ? x : -x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 200100;
struct Input {
  int n, m;
  int l[N], r[N];
  int ltv[N], rtv[N];
  int c[N];
  bool read() {
    if (scanf("%d %d", &n, &m) != 2) return 0;
    for (int i = int(0); i < int(n); ++i) {
      scanf("%d %d", &l[i], &r[i]);
    }
    for (int i = int(0); i < int(m); ++i) {
      scanf("%d %d %d", &ltv[i], &rtv[i], &c[i]);
    }
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  long long ans;
  pair<int, int> res;
  void write() {
    cout << ans << endl;
    if (ans > 0) {
      cout << res.first << ' ' << res.second << endl;
    }
  }
  virtual void solve() {}
  virtual void clear() { *this = Data(); }
};
const int inf = 1000000000;
struct seg_tree {
  int sz;
  vector<pair<int, int> > t;
  seg_tree() {}
  seg_tree(int n) {
    sz = 1;
    while (sz < n) sz <<= 1;
    t.assign(2 * sz, make_pair(0, -1));
  }
  pair<int, int> fnd(int i, int x, int y, int l, int r) {
    if (x > r || y < l) return make_pair(-inf, -1);
    if (x >= l && y <= r) {
      return t[i];
    }
    return max(fnd(2 * i, x, (x + y) >> 1, l, r),
               fnd(2 * i + 1, ((x + y) >> 1) + 1, y, l, r));
  }
  void upd(int v, int k, int idx) {
    v += sz;
    umx(t[v], make_pair(k, idx));
    v >>= 1;
    while (v > 0) {
      t[v] = max(t[2 * v], t[2 * v + 1]);
      v >>= 1;
    }
  }
};
struct item {
  int x, idx, tp;
  item() {}
  item(int x, int idx, int tp) : x(x), idx(idx), tp(tp) {}
};
inline bool operator<(const item& a, const item& b) {
  return (a.x < b.x || (a.x == b.x && a.tp < b.tp));
}
struct Solution : Data {
  pair<int, int> bst[N];
  void solve() {
    ans = 0;
    for (int i = int(0); i < int(m); ++i) {
      bst[i] = make_pair(0, -1);
    }
    process();
    for (int i = int(0); i < int(n); ++i) {
      l[i] = inf - l[i];
      r[i] = inf - r[i];
      swap(l[i], r[i]);
    }
    for (int i = int(0); i < int(m); ++i) {
      ltv[i] = inf - ltv[i];
      rtv[i] = inf - rtv[i];
      swap(ltv[i], rtv[i]);
    }
    process();
    for (int i = int(0); i < int(m); ++i) {
      ;
      if (umx(ans, 1ll * bst[i].first * c[i])) {
        res = make_pair(bst[i].second + 1, i + 1);
      }
    }
  }
  void process() {
    map<int, int> sj;
    vector<int> ord;
    vector<item> help;
    set<pair<int, int> > s;
    for (int i = int(0); i < int(n); ++i) {
      ord.push_back(l[i]);
      ord.push_back(r[i]);
    }
    for (int i = int(0); i < int(m); ++i) {
      ord.push_back(ltv[i]);
      ord.push_back(rtv[i]);
    }
    sort((ord).begin(), (ord).end());
    int cnt = 0;
    for (int i = 0; i < int(ord.size());) {
      int j = i;
      for (; j < int(ord.size()) && ord[i] == ord[j]; ++j)
        ;
      sj[ord[i]] = cnt++;
      i = j;
    }
    seg_tree t(cnt);
    for (int i = int(0); i < int(n); ++i) {
      help.push_back(item(l[i], i, 0));
      help.push_back(item(r[i], i, 2));
    }
    for (int i = int(0); i < int(m); ++i) {
      help.push_back(item(rtv[i], i, 1));
    }
    sort((help).begin(), (help).end());
    for (int i = int(0); i < int(help.size()); ++i) {
      if (help[i].tp == 0) {
        s.insert(make_pair(help[i].x, help[i].idx));
      } else if (help[i].tp == 2) {
        int idx = help[i].idx;
        s.erase(make_pair(l[idx], idx));
        t.upd(sj[l[idx]], r[idx] - l[idx], idx);
      } else {
        int idx = help[i].idx;
        umx(bst[idx], t.fnd(1, 0, t.sz - 1, sj[ltv[idx]], sj[rtv[idx]]));
        if (!s.empty()) {
          umx(bst[idx], make_pair(rtv[idx] - max(s.begin()->first, ltv[idx]),
                                  s.begin()->second));
        }
      }
    }
  }
  void clear() { *this = Solution(); }
};
Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
