#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long inf = LLONG_MAX;
long double pi = 3.1415926536;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int tt = 1;
  cin >> tt;
  while (tt--) {
    long long n, x = 0, m = 0, y = 0, k = inf;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    for (long long i = 1; i < n; i++) k = min(k, a[i] - a[i - 1]);
    cout << k << '\n';
  }
}
