#include <bits/stdc++.h>
using namespace std;
void program() {
  int n, temp;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    a.push_back(temp);
  }
  sort(a.begin(), a.end());
  int dif1, flag, minimum = a[1] - a[0];
  for (int i = 1; i < n - 1; i++) {
    dif1 = a[i + 1] - a[i];
    minimum = min(dif1, minimum);
  }
  cout << minimum << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) program();
  return 0;
}
