One way to solve this problem is to construct all possible fractions, reduce all of them as possible, sort them and print them.
Another way is to use DFS.
Lets start with (0,1) and see what can we build? (Check it yourself)
and fraction is something like this :
Another way is to use DFS.
Lets start with (0,1) and see what can we build? (Check it yourself)
and fraction is something like this :