Having mint function for 2 separate token id groups


So say I want to have 2 factions (groups) of say Robots for my NFT collection and during whitelist selection the community can get whitelisted for the specific faction they want. Would it possible (and gas efficient) to have two merkle trees or lists to hold each faction whitelist group and during whitelistMint depending on which group their address is in they mint a token from that group. I could make group 1 be tokens 1-5000 and group 2 tokens 5001 - 10000. Would it be possible to mint a token in that subset depending on which whitelist their address matches too?

Thanks in advance for the help, this problem has been stumping on the best solution for it.

yes of course it s possible.
Do you want to mint randomly or in sequence?

Thanks for the reply! Minting in sequence would be fine, unless I could do say randomly between 5000-10000 if the address minting is whitelist for faction/group 2!