#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    std::vector<int> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    int min = 100000;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (abs(v[i] - v[j]) < min) {
          min = abs(v[i] - v[j]);
        }
      }
    }
    cout << min << endl;
  }
}
