#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int ara[n];
    for (int i = 0; i < n; i++) {
      cin >> ara[i];
    }
    int min = ara[0], c;
    for (int i = 0; i < n - 1; i++) {
      for (int j = i + 1; j < n; j++) {
        if (ara[j] < ara[i]) {
          int temp = ara[i];
          ara[i] = ara[j];
          ara[j] = temp;
        }
      }
    }
    c = ara[n - 1] - ara[n - 2];
    for (int i = n - 1; i > 0; i--) {
      if (c > ara[i] - ara[i - 1]) c = ara[i] - ara[i - 1];
    }
    cout << c << endl;
  }
}
