P1458 [USACO2.1] Ordered Fractions

Description

Consider the set of all reduced fractions between $0$ and $1$ inclusive with denominators less than or equal to $N$. Here is the set when $N = 5$: $$\frac01,\frac15,\frac14,\frac13,\frac25,\frac12,\frac35,\frac23,\frac34 ,\frac45,\frac11$$ Write a program that, given an integer $N$ between $1$ and $160$ inclusive, prints the fractions in order of increasing magnitude.

Input Format

One line with a single integer $N$.

Output Format

One fraction per line, sorted in order of magnitude.

Explanation/Hint

USACO Training Section 2.1.