{"raw_statement":[{"iden":"problem statement","content":"You are given positive integers $n$, $a$, and $b$ such that $a<b$.\nAn integer pair $(L,R)$ such that $1\\leq L\\leq R$ is said to be a **good pair** when the following condition holds.\n\n*   Let $n_a$ and $n_b$ be respectively the number of multiples of $a$ and the number of multiples of $b$ among the integers between $L$ and $R$, inclusive. Then, $n_a - n_b = n$.\n\nIt can be proved that a good pair always exists. Report the good pair with the largest value of $R-L$. If multiple such pairs exist, report the one with the smallest $L$ (from $1\\leq L$, the sought $(L, R)$ with the smallest $L$ exists and is unique).\nYou have $T$ test cases to solve."},{"iden":"constraints","content":"*   $1\\leq T\\leq 2\\times 10^5$\n*   $1\\leq n \\leq 10^6$\n*   $1\\leq a < b \\leq 10^6$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$T$\n$\\text{case}_1$\n$\\vdots$\n$\\text{case}_T$\n\nEach test case is given in the following format:\n\n$n$ $a$ $b$"},{"iden":"sample input 1","content":"1\n3 3 5"},{"iden":"sample output 1","content":"4 35\n\n$(L,R)=(4,35)$ is a good pair since $n_a=10, n_b=7$.\nSome other good pairs are $(1,26)$ and $(10,41)$. $(1,26)$ is not the answer because it does not have the largest $R-L$. $(10,41)$ is not the answer because, although it has the largest $R-L$, it does not have the smallest $L$."},{"iden":"sample input 2","content":"5\n4 3 5\n6 2 4\n1 1 2\n123 456 789\n9876 54 321"},{"iden":"sample output 2","content":"10 50\n3 29\n2 4\n5473 140447\n163 641411"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}