basic match making implemented with recursion to check both directions