#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, a, b, finish1 = INFINITY, finish2 = INFINITY, start1 = 0,                        start2 = 0, mx = 0;     scanf( %lld , &n);     for (int i = 1; i <= n; i++) {       scanf( %lld %lld , &a, &b);       start2 = max(start2, a);       finish1 = min(finish1, b);     }     scanf( %lld , &n);     for (int i = 1; i <= n; i++) {       scanf( %lld %lld , &a, &b);       start1 = max(start1, a);       finish2 = min(finish2, b);     }     mx = max(mx, start1 - finish1);     mx = max(mx, start2 - finish2);     if (mx <= 0)       printf( 0 n );     else       printf( %lld n , mx);     return 0;   }   