#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int ans = 1e9;
    v.clear();
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      v.push_back(x);
    }
    sort(v.begin(), v.end());
    for (int i = 1; i < v.size(); i++) {
      ans = min(ans, abs(v[i] - v[i - 1]));
    }
    cout << ans << endl;
  }
  return 0;
}
