#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int u = 0; u < t; u++) {
    int a[50], n, r;
    bool g = false;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    r = abs(a[0] - a[1]);
    for (int i = 1; i < n - 1; i++) {
      if (r > (a[i + 1] - a[i])) r = a[i + 1] - a[i];
      if (r == 0) {
        cout << 0 << endl;
        g = true;
        break;
      }
    }
    if (g == false) cout << r << endl;
  }
  return 0;
}
