#include <bits/stdc++.h>
using namespace std;
int t, n, a[10000];
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    cin >> n;
    int ans = 1000000;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++) ans = min(ans, abs(a[i] - a[j]));
    cout << ans << "\n";
  }
}
