fcn joins(a,b){ a[-1]==b[0] } // the constraint