#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int s[n + 1];
    for (int i = 1; i <= n; cin >> s[i], ++i)
      ;
    sort(s + 1, s + n + 1);
    for (int i = n; i >= 2; --i) s[i] -= s[i - 1];
    int res = 0x3f3f3f3f;
    for (int i = 2; i <= n; ++i) res = min(res, s[i]);
    cout << res << '\n';
  }
  return 0;
}
