#include <bits/stdc++.h>

using namespace std;


int main(){
   int t; cin >> t;
   while (t--) {
      int n; cin >> n;
      vector<int> nums(n);
      for (int i = 0; i < n; i++) cin >> nums[i];
   
      sort(nums.begin(), nums.end());
   
      int minDiff = INT_MAX;
      for (int i = 1; i < n; i++) {
         minDiff = min(minDiff, nums[i] - nums[i - 1]);
      }
   
      cout << minDiff << endl;
   }
   return 0;
}