#include <bits/stdc++.h>
using namespace std;
int main() {
  int cnt;
  cin >> cnt;
  while (cnt--) {
    int num;
    cin >> num;
    int t[1005] = {0};
    for (int i = 0; i < num; ++i) {
      cin >> t[i];
    }
    sort(t, t + num);
    int min_val = 0x0FFFFFFF;
    for (int i = 1; i < num; ++i) {
      min_val = min(min_val, t[i] - t[i - 1]);
    }
    cout << min_val << endl;
  }
  return 0;
}
