#include <bits/stdc++.h>
using namespace std;
int athlete(int a[], int n) {
  int diff = 0, min = INT_MAX;
  sort(a, a + n);
  for (int i = 1; i < n; i++) {
    diff = a[i] - a[i - 1];
    if (diff <= min) {
      min = diff;
    }
  }
  return min;
}
int main() {
  int t, n, at;
  int a[50];
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n;
    for (int j = 0; j < n; j++) {
      cin >> a[j];
    }
    at = athlete(a, n);
    cout << at << endl;
  }
  return 0;
}
