#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> athletes(n);
  for (auto &athlete : athletes) cin >> athlete;
  sort(athletes.begin(), athletes.end());
  int diff = INT_MAX;
  for (int i = 1; i < n; ++i) {
    diff = min(diff, athletes[i] - athletes[i - 1]);
  }
  cout << diff << endl;
}
int main() {
  int numTests = 1;
  cin >> numTests;
  while (numTests--) solve();
}
