#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, c, d, e, f;
  vector<int> v;
  cin >> t;
  for (a = 0; a < t; a++) {
    cin >> b;
    f = 999;
    for (c = 0; c < b; c++) {
      cin >> d;
      v.push_back(d);
    }
    sort(v.begin(), v.end());
    for (c = b - 1; c > 0; c--) {
      e = v[c] - v[c - 1];
      if (e < f) {
        f = e;
      }
    }
    cout << f << endl;
    v.clear();
  }
}
