#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b;
    int a[b + 1];
    for (int j = 0; j < b; j++) cin >> a[j];
    sort(a, a + b);
    int mn = 999999;
    for (int j = 1; j < b; j++) {
      mn = min(a[j] - a[j - 1], mn);
    }
    cout << mn << endl;
  }
}
