Unfortunately, Apple doesn’t make this easy. The codes printed on Lightning or USB-C cables (like the *GJM51770HHF26GVCX* and *GJM51722RKM26GVCA* you listed) are internal serial or lot identifiers. They don’t directly tie back to a specific device’s serial number or box. Apple doesn’t expose a lookup that says “this cable belongs to this iPhone 16 Pro Max”* versus *“this one belongs to the iPhone 16.”
That said, there are a couple of practical approaches you can take. If both cables are the same type (for example, USB-C to USB-C), then functionally they’re identical — both the iPhone 16 and 16 Pro Max ship with the same kind of cable, and Apple doesn’t distinguish them by model. If you’re trying to preserve “factory correct” pairings, your best bet is to go back to the boxes: Apple usually places the cable underneath the phone tray. If you remember which one came out of which box, that’s the only way to be certain. Otherwise, there’s no technical difference — even resale value won’t be affected, since buyers know Apple ships the same standard cable across models.