#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  for (long long curT = 0; curT < t; ++curT) {
    long long n;
    cin >> n;
    vector<long long> in(n);
    for (long long i = 0; i < n; ++i) {
      cin >> in[i];
    }
    sort(in.begin(), in.end());
    long long minn = 1e18;
    for (long long i = 1; i < n; ++i) {
      minn = min(minn, in[i] - in[i - 1]);
    }
    cout << minn << "\n";
  }
}
