#include <bits/stdc++.h>
using namespace std;
int n, k, asdasjkd, adsnamsd, a[101], mna, mnb, b[101];
int ans;
int main() {
  int t23 = 1;
  cin >> t23;
  for (int qwe = 1; qwe <= t23; qwe++) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    ans = 1e9;
    sort(a + 1, a + n + 1);
    for (int i = 2; i <= n; i++) ans = min(ans, a[i] - a[i - 1]);
    cout << ans << endl;
  }
  return 0;
}
