#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n = 0;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < v.size(); i++) cin >> v[i];
  sort(v.begin(), v.end());
  vector<int> ans(n);
  ans[0] = INT_MAX;
  for (int i = 1; i < n; i++) {
    ans[i] = v[i] - v[i - 1];
  }
  cout << *min_element(ans.begin(), ans.end()) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc = 0;
  cin >> tc;
  while (tc--) {
    solve();
  }
  return 0;
}
