#include <bits/stdc++.h>
using namespace std;
bool com(long long a, long long b) { return a < b; }
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, d, ans = 1000;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    for (long long i = 1; i < n; i++) {
      d = a[i] - a[i - 1];
      ans = min(ans, d);
    }
    cout << ans << "\n";
  }
}
