Implement transaction network queries | Square Interview Question