#include <bits/stdc++.h>
using namespace std;
int main() {
  int tests;
  cin >> tests;
  for (int test = 0; test < tests; ++test) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    sort(a.begin(), a.end());
    int minn = 2000;
    for (int i = 0; i < n - 1; ++i) {
      if (a[i + 1] - a[i] < minn) {
        minn = a[i + 1] - a[i];
      }
    }
    cout << minn << '\n';
  }
}
