#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < (n - i - 1); j++) {
        if (a[j] > a[j + 1]) {
          int x = a[j];
          a[j] = a[j + 1];
          a[j + 1] = x;
        }
      }
    }
    int min = INT_MAX;
    for (int i = n - 1; i > 0; i--) {
      int diff = a[i] - a[i - 1];
      if (diff < min) min = diff;
    }
    cout << min << "\n";
  }
  return 0;
}
