#include <bits/stdc++.h>
using namespace std;
void getans() {
  int x = INT_MAX, n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (int i = 1; i < n; i++) {
    x = min(v[i] - v[i - 1], x);
  }
  cout << x << endl;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int c = 1;
  int t;
  cin >> t;
  while (t--) {
    getans();
    c++;
  }
}
