implement n to 1, 1 to n