Untangling the merger history of massive black holes with LISA