#include <bits/stdc++.h>
using namespace std;
int TN = 1;
void sol() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  long long ans = 1e18;
  for (int i = 1; i < n; ++i) {
    ans = min(ans, a[i] - a[i - 1]);
  }
  cout << ans << '\n';
}
int main() {
  cin >> TN;
  while (TN--) {
    sol();
  }
  return 0;
}
