#include <bits/stdc++.h>
using namespace std;
void printarray(int arr[], int n) {
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    int arr[n];
    for (int j = 0; j < n; j++) {
      cin >> arr[j];
    }
    sort(arr, arr + n);
    int m = arr[n - 1];
    for (int j = 0; j < n - 1; j++) {
      m = min(abs(arr[j] - arr[j + 1]), m);
      if (m == 0) break;
    }
    cout << m << "\n";
  }
  return 0;
}
