{"raw_statement":[{"iden":"problem statement","content":"You are given a positive integer $n$, and a prime number $p$ at least $5$.\nFind a triple of integers $(x,y,z)$ that satisfies all of the following conditions.\n\n*   $1\\leq x < y < z \\leq p - 1$.\n*   $(x+y+z)(x^n+y^n+z^n)(x^{2n}+y^{2n}+z^{2n}) \\equiv x^{3n}+y^{3n}+z^{3n}\\pmod{p}$.\n\nIt can be proved that such a triple $(x,y,z)$ always exists.\nYou have $T$ test cases to solve."},{"iden":"constraints","content":"*   $1\\leq T\\leq 10^5$\n*   $1\\leq n\\leq 10^9$\n*   $p$ is a prime number satisfying $5\\leq p\\leq 10^9$."},{"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 case is in the following format:\n\n$n$ $p$"},{"iden":"sample input 1","content":"3\n1 7\n2 7\n10 998244353"},{"iden":"sample output 1","content":"1 4 6\n1 2 5\n20380119 21549656 279594297\n\nFor the first test case:\n\n*   $(x+y+z)(x^n+y^n+z^n)(x^{2n}+y^{2n}+z^{2n}) = (1+4+6)(1+4+6)(1+16+36) = 6413$, and\n*   $x^{3n}+y^{3n}+z^{3n} = 1 + 64 + 216 = 281$.\n\nWe have $6413\\equiv 281\\pmod{7}$, so the conditions are satisfied."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}