#include <bits/stdc++.h>
using namespace std;
long long n, a[51];
bool cmp(long long x, long long y) { return x < y; }
void A() {
  long long ans = 1000000000;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1, cmp);
  for (long long i = 1; i < n; i++) ans = min(ans, abs(a[i] - a[i + 1]));
  printf("%lld\n", ans);
}
signed main() {
  long long q;
  scanf("%lld", &q);
  while (q--) A();
  return 0;
}
