#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long int MOD = 1000000007;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    vector<int> v(n);
    for (int i = int(0); i <= int(n - 1); i++) scanf("%d", &v[i]);
    sort(v.begin(), v.end());
    int mx = 1001;
    for (int i = 1; i < n; i++) {
      mx = min(mx, v[i] - v[i - 1]);
    }
    printf("%d", mx), printf("\n");
  }
  return 0;
}
