import Data.List
main=getContents>>=mapM (putStrLn.show.solve) . filter (\(a,b) -> mod a 2 == 0) . zip [1..] . map (map read . words) . init . lines
solve (_, ns) = let ss = sort ns in minimum . map abs $ zipWith (-) ss (tail ss)