#include <bits/stdc++.h>
using namespace std;
int a[1005];
pair<int, int> p[1005];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> p[i].first >> p[i].second;
    p[i].second += p[i].first;
  }
  int res = 0;
  for (int i = 0; i < m; i++) {
    int x1, y, x2;
    cin >> x1 >> y >> x2;
    x2 += x1;
    for (int j = 0; j < n; j++) {
      res = max(res, min(min(a[j] - x1, x2 - a[j]),
                         min(y - p[j].first, p[j].second - y)));
    }
  }
  cout << res << endl;
}
