#include <bits/stdc++.h>
using namespace std;
void FAST() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int Rselect(vector<int>&, int, int, int);
int partition(vector<int>&, int, int);
template <typename T>
ostream& operator<<(ostream& stream, const vector<T>& vec) {
  for (auto& i : vec) {
    stream << i << ' ';
  }
  stream << '\n';
  return stream;
}
template <class T>
istream& operator>>(istream& stream, vector<T>& vec) {
  for (auto& i : vec) {
    stream >> i;
  }
  return stream;
}
void solve();
void scanN(vector<long long>& v, long long n) {
  for (long long i = 0; i < n; i++) {
    int num;
    cin >> num;
    v.push_back(num);
  }
}
int main() {
  FAST();
  int test;
  cin >> test;
  while (test--) {
    solve();
  }
  return 0;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> s;
  scanN(s, n);
  sort(begin(s), end(s));
  vector<long long> diff(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    diff[i] = s[i + 1] - s[i];
  }
  sort(begin(diff), end(diff));
  cout << diff[0] << endl;
}
int Rselect(vector<int>& v, int i, int l, int r) {
  if (l == r) return v[l];
  int pivot = partition(v, l, r);
  if (pivot == i)
    return v[pivot - 1];
  else if (pivot < i) {
    return Rselect(v, i, pivot, r);
  } else {
    return Rselect(v, i, l, pivot - 2);
  }
}
int partition(vector<int>& v, int l, int r) {
  int pivot_index = rand() % (r - l + 1) + l;
  swap(v[pivot_index], v[l]);
  int i = l + 1, j = l + 1;
  while (j <= r) {
    if (v[j] < v[l]) {
      swap(v[j], v[i]);
      i++;
    }
    j++;
  }
  swap(v[l], v[i - 1]);
  return i;
}
