#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (long long i = 0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    long long ans = INT_MAX;
    for (long long i = 0; i < (n - 1); i++) ans = min(ans, v[i + 1] - v[i]);
    cout << ans << "\n";
  }
  return 0;
}
