  Let A, B, C, D be given finite sets of pairs of n-by-n complex matrices. We
describe an algorithm to determine, with finitely many computations, whether
there is a single unitary matrix U such that each pair of matrices in A is
unitarily similar via U, each pair of matrices in B is unitarily congruent via
U, each pair of matrices in C is unitarily similar via \bar{U}, and each pair
of matrices in D is unitarily congruent via \bar{U}.
