def a(memo, other)
      if keys == other.keys.take(keys.size)
        keys.each do |order|
          if other.keys.include?(order)
            memo << [order, flip_direction(other.assoc(order).last)]
          end
        end
      else
        keys.each do |order|
          if other.keys.include?(order)
            memo << other.assoc(order)
          end
        end
      end
    end
def a(memo, other)
      if keys == other.keys.take(keys.size)
        keys.each do |order|
          if other.keys.include?(order)
            memo << [order, flip_direction(other.assoc(order).last)]
          end
        end
      else
        keys.each do |order|
          if other.keys.include?(order)
            memo << other.assoc(order)
          end
        end
      end
    end
If the order of keys match upto the size of the set then flip them