const inp = require('fs').readFileSync('/dev/stdin', 'utf8');
const l = inp.trim().split('\n');
var n = null;
var ind = 0;
while (li = l.shift()) {
    const isN = ind % 2 === 0;
    const nAr = li.split(' ');
    if(isN){
        n = nAr[0];
    } else {
        /*var sSc = null;
        for(var i = 0; i < nAr.length; i++){
            for(var j = i+1; j < nAr.length; j++){
                let sDi = Math.abs(nAr[i] - nAr[j]);
                if(sSc === null){
                    sSc = sDi;
                } else {
                    if(sDi < sSc){
                       sSc = sDi; 
                    }
                }
            }
        }
        n = null;
        console.log(sSc);*/
    }
    ind ++;
} 
