Implementation of PartyRelabeling for # inputs, # outputs <= 16.