
    Given a list of transaction records where each record contains a source and destination account number, write a function that identifies and counts pairs of accounts engaged in reciprocal transactions (Account A sending to Account B, and Account B sending to Account A). The function should treat (A,B) and (B,A) as a single bidirectional transaction pattern and count such patterns only once to help detect potential coordinated financial activities between accounts.
    

    
def count_bidirectional(test_list):
    """
    Given a list of transaction records where each record contains a source and destination account number, write a function that identifies and counts pairs of accounts engaged in reciprocal transactions (Account A sending to Account B, and Account B sending to Account A). The function should treat (A,B) and (B,A) as a single bidirectional transaction pattern and count such patterns only once to help detect potential coordinated financial activities between accounts.
    

    """
def count_bidirectional(test_list):
    """
    Given a list of transaction records where each record contains a source and destination account number, write a function that identifies and counts pairs of accounts engaged in reciprocal transactions (Account A sending to Account B, and Account B sending to Account A). The function should treat (A,B) and (B,A) as a single bidirectional transaction pattern and count such patterns only once to help detect potential coordinated financial activities between accounts.
    

    """
    res = 0
    for idx in range(0, len(test_list)):
        for iidx in range(idx + 1, len(test_list)):
            if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]:
                res += 1
    return res