Try to think about what exactly means
You can rewrite it as the following 3 conditions:
Now we know the values of F(1),F(2),F(3) - the function F is fully determined, isn't it?
Note that (if you draw a picture) F is the same as f, but with all arrows reversed.
I think you could be able to do the second part in a similar way.