Create a thread-safe account service that handles deposits, withdrawals, and bank transfers between accounts while avoiding deadlocks at Revolut.
Implement process_operations(initial_balances, operations, workers). Each operation is a dictionary describing a deposit, withdrawal, or transfer. Execute operations concurrently and return results in input order together with final balances. Deposits and withdrawals lock one account; transfers must acquire two account locks in a consistent global order. A withdrawal or transfer fails without changing balances when funds are insufficient.
Input amounts are positive integers and all referenced accounts exist.
def process_operations(initial_balances, operations, workers):