The Meaningless Game
题意翻译
Slastyona和她的忠实狗狗普什克正在玩一个毫无意义但是很有趣的游戏。游戏包括多个回合。
它的规则非常简单:先选择一个自然数k。然后,谁说(或吠)的比另一个快就会赢得一局。胜利者的得分在那之后会乘以k的平方,而输了的人的得分就只能乘以k。比赛开始时,Slastyona和PurSok都有一个初始分数。不幸的是,Slastyona丢失了记事本,那里记录了他们玩过的N个游戏的历史。她设法回忆了每一场比赛的最终结果,但是记忆都很模糊。帮助Slastyona验证它们的正确性,或者,换句话说,对于每一对给定的分数,确定游戏是否能够完成这样的结果。
感谢@AstoriaG 提供的翻译
题目描述
![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF833A/28a3b44282ccdbacfa3b5998d49bb6aaf4e51076.png)Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.
The game consists of multiple rounds. Its rules are very simple: in each round, a natural number $ k $ is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is multiplied by $ k^{2} $ , and the loser's score is multiplied by $ k $ . In the beginning of the game, both Slastyona and Pushok have scores equal to one.
Unfortunately, Slastyona had lost her notepad where the history of all $ n $ games was recorded. She managed to recall the final results for each games, though, but all of her memories of them are vague. Help Slastyona verify their correctness, or, to put it another way, for each given pair of scores determine whether it was possible for a game to finish with such result or not.
输入输出格式
输入格式
In the first string, the number of games $ n $ $ (1<=n<=350000) $ is given.
Each game is represented by a pair of scores $ a $ , $ b $ $ (1<=a,b<=10^{9}) $ – the results of Slastyona and Pushok, correspondingly.
输出格式
For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise.
You can output each letter in arbitrary case (upper or lower).
输入输出样例
输入样例 #1
6
2 4
75 45
8 8
16 16
247 994
1000000000 1000000
输出样例 #1
Yes
Yes
Yes
No
No
Yes
说明
First game might have been consisted of one round, in which the number $ 2 $ would have been chosen and Pushok would have won.
The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number $ 5 $ , and in the second one, Pushok would have barked the number $ 3 $ .