def ascan; gets.split.map(&:to_i); end

gets;
t = ascan.combination(2).map{|l,r|r-l}
p t.min
p t.max