def search_in_sorted_matrix(A, x):
    for S in A:
        if binary_search(S, x):
            return True
    return False
def search_in_sorted_matrix(A, x):
    for S in A:
        if binary_search(S, x):
            return True
    return False