#include<iostream>
#include<climits>
#include<algorithm>
using namespace std;
class solution
{
public:
void solve()
{
int n;
cin >> n;
int* arr = new int[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
sort(arr,arr + n);
int dif = 0, minimum = INT_MAX;
for (int i = 0; i < n; i++)
{
dif = abs(arr[i] - arr[i + 1]);
if (dif < minimum)
minimum = dif;
}
cout << minimum << "
";
delete[] arr;
}
};
int main()
{
solution ss;
int t;
cin >> t;
while (t--)
{
ss.solve();
}
return 0;
}