#include <bits/stdc++.h>
using namespace std;
int num[60], flag[2000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, f = 1;
    cin >> n;
    memset(flag, 0, sizeof(flag));
    for (int i = 1; i <= n; i++) {
      cin >> num[i];
      if (flag[num[i]]) {
        f = 0;
      }
      flag[num[i]] = 1;
    }
    if (!f) {
      cout << 0 << endl;
      continue;
    }
    sort(num + 1, num + 1 + n);
    int ans = 1e9;
    for (int i = 1; i < n; i++) {
      ans = min(abs(num[i + 1] - num[i]), ans);
    }
    cout << ans << endl;
  }
}
