#include <bits/stdc++.h>
using namespace std;
void codeforces() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  codeforces();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    long long d = INT_MAX;
    for (long long i = 0; i < n; i++) cin >> a[i];
    for (long long i = 0; i < n; i++) {
      for (long long j = i + 1; j < n; j++) {
        d = min(d, abs(a[i] - a[j]));
      }
    }
    cout << d << endl;
  }
  return 0;
}
