A set of lists of a pair [function value] is little bit tricky, but passed all tests.