#include <bits/stdc++.h>
using namespace std;
int i = 0, j = 0;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool isPowerOfTwo(long long n) { return n && (!(n & (n - 1))); }
bool is_numeric(char c) { return c >= 'a' and c <= 'z'; }
string decToBinary(int n) {
  string binaryNum;
  int i = 0;
  while (n > 0) {
    binaryNum.push_back(n % 2);
    n = n / 2;
    i++;
  }
  return binaryNum;
}
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (i = 0; i < n; ++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  int mini = INT_MAX;
  for (i = 1; i < n; ++i) {
    mini = ((mini) < (v[i] - v[i - 1]) ? (mini) : (v[i] - v[i - 1]));
  }
  cout << mini << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int test;
  cin >> test;
  while (test--) {
    solve();
  }
}
