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