#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    int dif = INT_MAX;
    for (int i = 0; i < n; i++) cin >> arr[i];
    int locmin;
    for (int i = 0; i < n - 1; i++) {
      for (int j = i + 1; j < n; j++) {
        locmin = abs(arr[j] - arr[i]);
        if (locmin < dif) {
          dif = locmin;
        }
      }
    }
    cout << dif << endl;
  }
  return 0;
}
