sort and search circus given string & matrix element