#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int m = INT_MAX;
  for (int i = 0; i < n - 1; i++) {
    if (a[i + 1] - a[i] < m) {
      m = a[i + 1] - a[i];
    }
  }
  cout << m << endl;
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
