#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int t, n[maxn], s[maxn], difference[maxn];
int main() {
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n[i];
    difference[i] = 10000;
    for (int j = 0; j < n[i]; j++) {
      cin >> s[j];
    }
    sort(s, s + n[i]);
    for (int j = 1; j < n[i]; j++) {
      difference[i] = min(difference[i], (s[j] - s[j - 1]));
    }
  }
  for (int i = 0; i < t; i++) {
    cout << difference[i] << endl;
  }
}
