{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFermat\u0027s theorem states that for any prime number \u003ci\u003ep\u003c/i\u003e and for any integer \u003ci\u003ea\u003c/i\u003e \u0026gt; 1, \u003ci\u003ea\u003csup\u003ep\u003c/sup\u003e\u003c/i\u003e \u003d \u003ci\u003ea\u003c/i\u003e (mod \u003ci\u003ep\u003c/i\u003e). That is, if we raise \u003ci\u003ea\u003c/i\u003e to the \u003ci\u003ep\u003c/i\u003e\u003csup\u003eth\u003c/sup\u003e power and divide by \u003ci\u003ep\u003c/i\u003e, the remainder is \u003ci\u003ea\u003c/i\u003e. Some (but not very many) non-prime values of \u003ci\u003ep\u003c/i\u003e, known as base-\u003ci\u003ea \u003c/i\u003epseudoprimes, have this property for some \u003ci\u003ea\u003c/i\u003e. (And some, known as Carmichael Numbers, are base-\u003ci\u003ea\u003c/i\u003e pseudoprimes for all \u003ci\u003ea\u003c/i\u003e.)\u003c/p\u003e\u003cp\u003eGiven 2 \u0026lt; \u003ci\u003ep\u003c/i\u003e ≤ 1000000000 and 1 \u0026lt; \u003ci\u003ea\u003c/i\u003e \u0026lt; \u003ci\u003ep\u003c/i\u003e, determine whether or not \u003ci\u003ep\u003c/i\u003e is a base-\u003ci\u003ea\u003c/i\u003e pseudoprime.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eInput contains several test cases followed by a line containing \"0 0\". Each test case consists of a line containing \u003ci\u003ep\u003c/i\u003e and \u003ci\u003ea\u003c/i\u003e. \u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, output \"yes\" if p is a base-\u003ci\u003ea\u003c/i\u003e pseudoprime; otherwise output \"no\".\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 2\r\n10 3\r\n341 2\r\n341 3\r\n1105 2\r\n1105 3\r\n0 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eno\r\nno\r\nyes\r\nno\r\nyes\r\nyes\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}