#include <bits/stdc++.h>
using namespace std;
const int M = 1e3 + 10;
const int inf = 0x3f3f3f3f;
int t, n, ans;
int dp[M];
int main() {
  scanf("%d", &t);
  while (t--) {
    ans = inf;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &dp[i]);
    sort(dp, dp + n);
    for (int i = 1; i < n; i++) ans = min(ans, dp[i] - dp[i - 1]);
    printf("%d\n", ans);
  }
  return 0;
}
