sorted output for 1 res, 2p, 3p