F=->a,b{ return false if b.size<2 r=false a.each{|c| (1...c.size).each{|i| if e=b.find{|d|d[0]==c[i]} b.delete e f=b.find{|g|g[-1]==c[i-1]} b.delete f b<