Timer is Running

Given a number **N**. Find the values of a and b such that a/b is the largest proper fraction and a + b = **N**. Following are constraints for fraction.

1.a/b is a proper fraction if a is less than b and a and b are co-primes i.e no common factor of a and b.

2.There can be multiple proper fractions with sum of numerator and denominator equal to a given number. The main task is to find values of a and b for which the fraction is having the maximum floating point value.

**Input:**

The first line consists of an integer **T** i.e number of test cases. The first and only line of each test case consists of an integer **N**.

**Output:**

Print the values of a and b with spaces in between.

**Constraints:**

1 <= T <= 100

3 <= n <= 10^{5}

**Example:
Input:**

2

3

12

1 2

5 7

Author: saksham0751

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

saiujwal13083 | 269 |

ppsvikhyat17 | 268 |

reclone_rk | 220 |

vt9941 | 216 |

bikramjs97 | 212 |

saiujwal13083 | 528 |

ppsvikhyat17 | 456 |

generic_coder | 424 |

vt9941 | 340 |

SourabhPatel | 328 |

blackshadows | 5448 |

Ibrahim Nash | 5438 |

akhayrutdinov | 5111 |

mb1973 | 4976 |

Quandray | 4752 |

Login to report an issue on this page.