function bestassignment = matchpeople(q)
bestassignment = 0;
bestqualitysofar = -Inf;
jobs = 1:4;
for a = jobs
   jobsforb = exclude(jobs,a); 
   for b = jobsforb
      jobsforc = exclude(jobsforb,b);
      for c = jobsforc;
         jobsford = exclude(jobsforc,c);
         for d = jobsford
            totalquality = q(1,a) + q(2,b) + ...
               q(3,c) + q(4,d);
            if totalquality > bestqualitysofar
               bestqualitysofar = totalquality;
               bestassignment = [a b c d];
            end
         end
      end
   end
end