#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int long long n, a[60], mx = 2000;
    scanf("%lld", &n);
    for (int i = 0; i < n; i++) {
      scanf("%lld", &a[i]);
    }
    sort(a, a + n);
    for (int i = 1; i < n; i++) {
      mx = min(mx, abs(a[i - 1] - a[i]));
    }
    printf("%lld\n", mx);
  }
  return 0;
}
