#include <bits/stdc++.h>
using namespace std;
int main() {
  int T, n, ar[100];
  cin >> T;
  while (T--) {
    int flag = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> ar[i];
    sort(ar, ar + n);
    flag = ar[1] - ar[0];
    for (int i = 1; i < n - 1; i++) {
      if (flag > ar[i + 1] - ar[i]) {
        flag = ar[i + 1] - ar[i];
      }
    }
    cout << flag << "\n";
  }
}
