#include <bits/stdc++.h>
using namespace std;
int n, m;
int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * f;
}
int s[101010];
int main() {
  int T = read();
  while (T--) {
    n = read();
    for (int i = 1; i <= n; ++i) {
      s[i] = read();
    }
    sort(s + 1, s + n + 1);
    int ans = 101010101;
    for (int i = 1; i < n; ++i) {
      ans = min(ans, abs(s[i + 1] - s[i]));
    }
    cout << ans << endl;
  }
}
