Build a banking system with CREATE, DEPOSIT, TRANSFER, MERGE, and GET_BALANCE operations. A MERGE at time t combines account_id_2 into account_id_1: account_id_1 keeps existing and gains all of account_id_2's current money, while account_id_2 stops existing from time t onward. A GET_BALANCE query asks for the balance that a specific account had at an earlier time `time_at`. Return None if the account had not been created yet at `time_at`, or if it had already been merged away by `time_at`.
Examples
Input: ([['CREATE', 1, 'a'], ['CREATE', 2, 'b'], ['DEPOSIT', 3, 'a', 50], ['DEPOSIT', 4, 'b', 30], ['MERGE', 5, 'a', 'b'], ['GET_BALANCE', 6, 'a', 4], ['GET_BALANCE', 7, 'a', 5], ['GET_BALANCE', 8, 'b', 4], ['GET_BALANCE', 9, 'b', 5]],)
Expected Output: [True, True, 50, 30, True, 50, 80, 30, None]
Explanation: Before the merge, a had 50 and b had 30. At time 5, a becomes 80 and b stops existing.
Input: ([['CREATE', 1, 'x'], ['CREATE', 2, 'y'], ['DEPOSIT', 3, 'x', 100], ['TRANSFER', 4, 'x', 'y', 40], ['GET_BALANCE', 5, 'x', 3], ['GET_BALANCE', 6, 'y', 4], ['MERGE', 7, 'y', 'x'], ['GET_BALANCE', 8, 'y', 7], ['GET_BALANCE', 9, 'x', 6], ['GET_BALANCE', 10, 'x', 7]],)
Expected Output: [True, True, 100, 60, 100, 40, True, 100, 60, None]
Explanation: After the transfer, x has 60 and y has 40. Merging x into y at time 7 makes y equal 100 and removes x from that time on.
Input: ([['CREATE', 1, 'a'], ['MERGE', 2, 'a', 'a'], ['GET_BALANCE', 3, 'a', 0], ['GET_BALANCE', 4, 'missing', 1], ['DEPOSIT', 5, 'missing', 10]],)
Expected Output: [True, False, None, None, None]
Explanation: Merging an account with itself is invalid. Historical queries before creation or for unknown accounts return None.
Input: ([],)
Expected Output: []
Explanation: Edge case: no queries.