#include <bits/stdc++.h>
using namespace std;
struct compare {
  bool operator()(pair<long long int, long long int> a,
                  pair<long long int, long long int> b) {
    if ((a.second - a.first) > (b.second - b.first))
      return false;
    else if ((a.second - a.first) == (b.second - b.first)) {
      if (a.first < b.first)
        return false;
      else
        return true;
    } else
      return true;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, b;
    cin >> n;
    vector<long long int> a(n);
    for (long long int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    long long int ans = 10000000;
    for (long long int i = 0; i < n; i++) {
      for (long long int j = i + 1; j < n; j++) {
        ans = min(ans, a[j] - a[i]);
      }
    }
    cout << ans << endl;
  }
}
