#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const long long mod = 998244353;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long T;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    long long s[n];
    long long i, j, l;
    for (i = 0; i < n; i++) {
      cin >> s[i];
    }
    sort(s, s + n, greater<long long>());
    long long diff = INF;
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        if (i != j) {
          long long cl = abs(s[j] - s[i]);
          diff = min(diff, cl);
        }
      }
    }
    cout << diff << "\n";
  }
}
