optimized O(n^3) for RRFRNDS