#include <bits/stdc++.h>
using namespace std;
void solve(void) {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  int res = 9999;
  for (int i = 0; i < n - 1; i++) {
    if (abs(arr[i] - arr[i + 1]) < res) {
      res = abs(arr[i] - arr[i + 1]);
    }
  }
  cout << res << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
