#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int s[55];
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    sort(s, s + n, greater<int>());
    int min = INT_MAX;
    for (int i = 0; i < n - 1; i++) {
      int temp = s[i] - s[i + 1];
      if (temp < min) min = temp;
    }
    cout << min << endl;
  }
}
