I’ve seen magician do similar. i think he had the memory and that trick was not a trick. Jerry Lucas an Ohio State/NBA player from the 60s had photographic memory and he made million selling books and lessons about how to improve your memory.
https://www.youtube.com/watch?v=Sn19xh3qHmI