_,*A=$<.map{|s|s.split.map(&:to_i).sort} A.sort! p (0..$.-2).map(&f=->i{$*[i]||=(0...i).map{|j|A[j].zip(A[i]).all?{|a,b|a