basic implementation for UCS search