#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int mi = INT_MAX;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      mi = min(mi, abs(arr[i] - arr[j]));
    }
  }
  cout << mi;
  cout << endl;
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
