#include <iostream>
#include<algorithm>
#include <cmath>
using namespace std;
int main() {
int t;
cin >> t;
int n;
cin >> n;
int* ch = new int[n];
int* wa = new int[n];
int max1 = 0;
int max2 = 0;
int an = 0;
for (int i = 1; i <= t; i++) {
max1 = 0;
for (int j = 0; j < n; j++)
cin >> *(wa+j);
for (int j = 0; j < n; j++)
cin >> *(ch+j);
for (int k = 0; k < n; k++)
if (max1< (*(ch+k) - *(wa+k)))
max1 = ch[k] - wa[k];
cout << max1 << endl;
}
delete[] ch;
delete[] wa;
}